On Fri, 24 Nov 2006, umesh pandey wrote: > What is the difference if I implement a structure given in net_fdm_mini.cxx > source code and send this struct as a UDP packet for interfacing with > Flightgear?????or is it necessary to use complete structure given in > net_fdm.cxx????? I have taken a look at native_fdm.cxx file also and found > that we have to do htonl > or htonf before sending the packets......is it necessary????I am a newbie in > this area.......I also would > like to know about what are the padding differences and network byte order > mean?????
When you send data between two computers it is extremely important that what the sending side sends is formated _exactly_ as the receiver expects. Otherwise the receiver cannot interpret the message correctly. If both of your computers have the same architecture, run similar operating systems and both programs are compiled with the same compiler (and same version) then one can be reasonably sure that just sending the in-memory representation of a struct between the computers will succeed. However, for a multiplatform application like FlightGear one has to do something better. That is, to define exactly how the sent messages should be formated (i.e. their binary representation) and ensure that this can be encoded/decoded on every platform. So, yes you have to use htonf, etc :) Sorry for the rant.. :P I think I remember a similar discussion on this list earlier this year. I'll see if I can find it. /Anders -- --------------------------------------------------------------------------- Anders Gidenstam mail: andersg(at)gidenstam.org WWW: http://www.gidenstam.org/FlightGear/JSBSim-LTA/ ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel