The problem is that every compiler is different. In a word, padding sucks . No data Notice that strings are not NULL terminated. Sorry C programmers, but I wanted to keep the protocol clean. Using the above elements I put together a few different messsages that are needed to transfer the information between the server and the client.
Every message starts with the same header information.
This way the first part of the message can be read no matter what type of message it is. Length This is the length in bytes of the whole message including the header. Type The type code that identifies the format and intention of the rest of the message. This is a client supplied identifier that is used to correlate requests and answers. For example the client makes up a number and sends it to a server in a data request message.