Python - network buffer handling question...
- by Patrick Moriarty
Hi, I want to design a game server in python. The game will mostly just be passing small packets filled with ints, strings, and bytes stuffed into one message. As I'm using a different language to write the game, a normal packet would be sent like so:
Writebyte(buffer, 5); // Delimit type of message
Writestring(buffer, "Hello");
Sendmessage(buffer, socket);
As you can see, it writes the bytes to the buffer, and sends the buffer. Is there any way to read something like this in python? I am aware of the struct module, and I've used it to pack things, but I've never used it to actually read something with mixed types stuck into one message. Thanks for the help.