Örn Vidarsson wrote:
> My question is:
>
> How can i send a struct through a socket?
> The struct can f.x look like this:
>
> struct any{
> float ....
> double ...
> char ...
> }
>
> I want too send the whole structure in one command, is this posible?
Yes, but it is not the best way. For simple tests it may work fine, but
structures may have padding added to them, and the padding can be affected by
compiler switches and the platform you are compiling on. Oh, not to mention
endian differences.....
> If not, wich way is the "correct" way?
One 'correct' way is to write each element of the structure to a new buffer and
send that, then on the other end read from the buffer and save them back to the
structure.
--
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com