Orb:Connect alpha released

Status
Not open for further replies.
kuddel I must say GREAT JOB MAN xD my crazyness will became to me another day :D

I supose that the problem was at the end of line but I wasn't know how to resolve... another time THANKS a lot :D

If I have some time I will make a tutorial about working with this from PHP and for the people who wants to make their own "spacelines" like simnasa I'll explain how get data from their vessels directly from their webs. Represent graphics or whatever they want. :D

Thanks last time xD

And thats of course another way to make the same thing:

PHP:
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, '127.0.0.1', '37777');
$entry = "FOCUS:Name\r\n";
socket_write($socket, $entry, strlen($entry));
echo socket_read($socket,1024);
socket_close($socket);
?>
(To put code with the dollars on good position just turn off the "Automatically embed media" and "Automatically parse links in text" checkbox's)

Greetings to all!!


-----Posted Added-----


I've made a PHP Class using what i've learned to easy use sockets:

PHP:
<?php
class OrbConnect
{
    var $socket;    
    function __construct($ip = '127.0.0.1', $port = 37777, $timeout = 30)
    {
        if (!$this->socket = @fsockopen("tcp://$ip",$port, $errno, $errstr, $timeout))
            trigger_error('Error on connect ($errno)', E_USER_ERROR);
    }    
    function operation($param, $result_only = true)
    {
        if(!fwrite($this->socket, $param."\r\n"))
            trigger_error('Can\'t send data to OrbConnect', E_USER_ERROR);    
        if(!$data = fgets($this->socket))
            trigger_error('Can\'t retrieve data from OrbConnect', E_USER_ERROR);        
        if($result_only == true)
        {
            $array = split('=',$data);
            $data = $array[1];
        }        
        $data = trim($data);
        if($data == '')
            trigger_error('Maybe there are no server there or the data is NULL', E_USER_NOTICE);        
        return $data;
    }    
    function __destruct()
    {
        fclose($this->socket);
    }
}

$OrbConnect = new OrbConnect();
echo $OrbConnect->operation('FOCUS:Name');
echo $OrbConnect->operation('ORB:GBodyCount');
echo $OrbConnect->operation('ORB:SimMJD');
unset($OrbConnect);
?>
Simple to use but documentation incomming.
 
Hi Alrik,
nice to hear that it really helped.The project your'e about to do, looks promessing. Beginning from XML-Export, over visualisations on a web-backend (WebVirtualMissionControl) to any display of current activity.
By the way: We should inform the author of OrbConnect about this, so he/she can add this important note to the documentation.
/Kuddel
 
Last edited:
Hi again Kuddel

I'm with you in the point that we should inform the author about this new interesting info. I supose that he will see this posts in the upcoming days.

Anyway I've finished the documentation about the class:

http://docs.google.com/Doc?id=dhcphp4h_54zsgr8wm2

Everyone can see it on google docs. PDF incomming.


-----Posted Added-----


I have another question:

What exactly means "OrbConnect::recv returned 0; closing"

On the OrbConnect code it represent the next:

-> iResult = recv(clients.at(lParam).TCPClient, recvbuf, recvbuflen, 0);

if (iResult == 0)
{
oapiWriteLog("OrbConnect::recv returned 0; closing");
closesocket(clients.at(lParam).TCPClient);
ReleaseMutex(clients.at(lParam).mutex);
return 1;
}

Why this error happens? (I can reproduce it in DG Mk 4 in orbit mission making connections every 0.3 secs)

It crash orbiter minutes later.
I've seen the orbiter log and its filled with "OrbConnect::recv returned 0; closing" messages.

With 0.5 secs the program looks not to crash but stay login errors.

Any Ideas?
 
But it's just a notice? or the connection has been closed by me?

I say it because in my tests the orbiter.log get filled with that kind of notices... and makes a really big log 0.5 MB. About 3 hours in realtime with sim running at 1x.

The problem is that I dont know if its a problem of my own code or just a problem of the OrbConnect related to Orbiter.

"If the connection has been gracefully closed, the return value is zero."

What means gracefully in this context?

:huh:

Sorry about my tired list of questions xD I'm just trying to debug my codes all that I can.
 
hello all

I've tried to use the system with Orbiter MC but I always get this message

Code:
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OverflowException: Arithmetic operation resulted in an overflow.
   at orbiterMC.Form1.renderMap()
   at orbiterMC.Form1.Timer1_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.Callback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
orbiterMC
    Assembly Version: 1.0.3096.28220
    Win32 Version: 1.0.3096.28220
    CodeBase: file:///C:/Documents%20and%20Settings/XP/Desktop/Orbiter/orbiterMC.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 7.0.5000.0
    Win32 Version: 7.10.6001.4
    CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Accessibility
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------
System.Xml
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2032
    CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

how do I fix this ?
 
hello all

I've tried to use the system with Orbiter MC but I always get this message
<snip>
how do I fix this ?
That would be an OrbiterMC question, or maybe someone with .NET experience. I would post a new message in the Addon support forum and mention OrbiterMC in the title
 
Thread closed at authors request.
 
Status
Not open for further replies.
Back
Top