On Tuesday, June 24, 2003, at 11:53AM, Martin Spott <[EMAIL PROTECTED]> wrote:

>"Curtis L. Olson" <[EMAIL PROTECTED]> wrote:
>
>> The structure is defined in src/Network/net_ctrls.hxx
>
>Yep, I already read this, but I'm not shure about the the data format of the
>values I have to put in there.
>
>I assume the bools have exactly one bit anytime but how large are the
>variable values ....  or with other words: Won't I have to worry about the
>platform FlightGear is currently running on ? I suspect 'double' and 'int'
>will differ and the whole stuff depends on the CPU's byte order, so I have
>to take serious bit-shifting into account, when running the application on
>different platforms.
>

By default, everything that is transferred is done so in network format (big-endian).  
IMNSHO, sending data in any other format is asking for trouble (i.e., how can I send 
data from my PowerPC to my x86 box if it is not in network format).  Look at 
source/src/Network/native_ctrls.cxx to see how the data is processed.  The sizes are:

Boolean = 8-bits
Integer = 32-bits
Float   = 32-bits
Double  = 64-bits

Don't forget data elignment.  The C/C++ compiler will pad data so that is alighed per 
the processor's architecture.  This means that an array of three bytes that is 
followed by an integer will *MOST LIKELY* have a hidden fourth byte applied after the 
array and before the integer.  The compiler will align data on its native boundary 
(i.e., 32-bit numbers will start on a 32-bit boundary).


>Is an EOL the correct ending of a set of control data over a socket or
>serial line ?
>

Don't send any line termination.  What is being received over the network is a stream 
of bytes, not text.  When the receiver has enough data, it will be processed.


Jonathan Polley

Of COURSE they can do that.  They're engineers!

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to