I'm starting to work the thinking of my network programming and since I am still new to network programming I need a little help. When I receive a packet, I understand it can fail and go into an invalid state if I read more than the packet has. What exactly does this mean?
Second, the tutorial shows it extracting everything from the packet in the same line. Can I instead pull the first bit of information from the packet, x in this case, then do some sort of if statement and decide to pull the next bit of information from the packet. My idea is to have the first bit of each packet sent be a variable that tells the receiver what the packet is, IE is this a chat message that needs to be handled by the chat portion or is it some game info and if so what kind of game info so the packet is not over extracted.