I need to send a request via a python socket with the following structure:
{
Uint16 data_one
Uint16 data_one
Uint32 data_one
}
I have my server and client working, but i do not really know how can i encode and decode this kind of data to send it over the socket. Thanks!
Take a look at the functions in the
struct
module. Usestruct.pack
to generate the bytestream and send it over the wire, then usestruct.unpack
on the other end to unpack the data: