Hi Drew,
I have recently been experimenting with the protocols that FG can put out via the socket i/face... there seems to be a distinct lack of specification of the data structures that each protocol puts out. It has been suggest that examining the Protocols.hxx file from CVS might be the easiest way to shed some light on this.

I have got a tcp session to link to the property tree and can set property tree values via that session. (I wrote I special app that navigates the tree for me but used a telnet session to test it)

Most og the other supprted protocols send data in binary format and will be largely unreadable unless you have a compatible data structure to receive them in.

Cheers
:=D ene



From: "Drew Kirkpatrick" <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: [Flightgear-users] FDM sockets out problem...
Date: Thu, 2 Mar 2006 22:53:53 -0500

I'm none too familiar with sockets programming, so bear with me here.
I'm starting flightgear like so:

fgfs --native-fdm='socket,out,30,localhost,5050,udp'

And have a listener running on localhost 5050. At this point I'm just
trying to print out the fdm values, but I'm getting garbage. Anyone
point out how to read an object in? This is my recvfrom call:

       FGNetFDM fdm;
       while(1)
         {
           if ((numbytes = recvfrom(sockfd, reinterpret_cast<char*>(&fdm),
                                    sizeof(fdm)-1, 0,
                                    (struct sockaddr *)&their_addr,
&addr_len)) == -1) {
             perror("recvfrom");
             exit(1);
           }
           printf("packet is %d bytes long\n",numbytes);
           rintf("Supposedly have an altitude of: %f\n", fdm.altitude);
         }


Anyone know what the appropriate recvfrom call would be here? I'm
definitely getting packets from flightgear, I'm just mangling the
data, the altitude print out is all over the place. Either I'm not
calling recvfrom correctly, or I'm neglecting to convert the value
somehow. Any tips? Mucho thanks in advance.

-Drew


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Flightgear-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-users

_________________________________________________________________
Become a fitness fanatic @  http://xtramsn.co.nz/health



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Flightgear-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-users

Reply via email to