I've been working on a small client/server multiplayer game in linux, with the intent to porting the client to other os's at a later date. Keeping portablity in mind, does anyone have any suggestions on how to send data between the client and the server. I was initially sending binary data, thinking that it would make for smaller packets, but then realized that writing sizeof(foo)
bytes on one machine and reading sizeof(foo)
bytes on another machine wouldn't work, if their internal representations are different (alphas for instance). Also, am I correct in assuming that endian-ness would also render this method useless, without conversion to network byte order when sending and recieving?
The only other option left seems to be converting all data into ascii text strings, sending it, and then converting the text back into integers/floats ect. Would printf()/scanf() do the trick? Does anyone know how this is done 'in the real world'?
Thanks a bunch
[This message has been edited by genovov (edited November 17, 1999).]