Getting into socket programming with C++, and I'd like to find a way to marshal a series of data types into a string of bytes to be sent over a network via a socket using UDP.
Here's the method header
char * Message::marshal( int &n)
and the series of data types I need to marshal are:
int int int int float //need to be all marshaled into the same byte string
The length is saved to n, and the string of bytes is returned in a character array. I'd also like to know how to unmarshal that string of bytes as well.
The server I'm working on most likely doesn't have boost library, and is probably not updated to C++ 11. The last server I was in wasn't, so I'm going to assume they didn't update them yet.
One method of serializing I saw was using streams, but I saw something about non portability (I'm writing the source code in windows, and then I'll change a few things for unix and compile it on the unix server).
I need to use standard C++ library stuff as again I have no control over the server.