   variable packet length
  Hi. I've read the Forum FAQ and I can get packets with a fixed length sent and received and decoded properly. First I make a char *buffer, and fill it from the socket, then read the packet type and recast it into the proper type. The packet gets filled on its own just by lining up the data.#pragma pack(1)struct packet{  uint16_t messageID;  uint32_t someOtherValue;};#pragma pack()But what if the packets aren't of a fixed length? Now I can't simply have a packed struct that represents a packet because I don't know how many fields I'll need.So I'm left with a char *, and the length, but I don't know how to get a packet out of that. What do I do?   
  The simple answer is to send the length of your packet (or the length of the variable length items) in with the packet data.There are a lot of different ways to handle this but one way would be based on the message ID.for instance if messageID == 13 which is SENDALLPLAYERHP, that could mean that you need to read 1 byte in for how many players there are, then read that many ints to know the life of each player.Make sense?   