Reading socket binary data?
Michael Simpson
msimpson at hotmail.com
Thu Feb 27 20:36:27 EST 2003
How would a Python developer handle the following case. I'm a C++ developer
looking at Python as a new language to learn.
In C:
struct FOO
{
short a;
char b;
long c;
}
I can read something into a data object using the sizeof(FOO)
i.e. recv(socket, buffer, sizeof(FOO),....
In Python, I get
data = socket.recv(1024)
How to I translate data to a struct FOO type or a series of objects that
represent those fields?
Thanks,
Padawan
More information about the Python-list
mailing list