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

Reply via email to