About data structure
Jon Parise
jon at csh.rit.edu
Mon Sep 30 15:32:24 EDT 2002
On Mon, Sep 30, 2002 at 09:29:52PM +0200, malan wrote:
> I need to build a data structure like this :
>
> size 4 bytes ( example 0x0000000A )
> flag 1 byte ( example 0x87 )
> trans 8 bytes ( example 'URTVMI1' )
> F5 3 bytes ( example 0x00125C )
>
> How can I define that structure, format it and send it via a socket ?
> My problem is to code / decode the message to and from the server.
You want to use the 'struct' module:
http://www.python.org/doc/current/lib/module-struct.html
--
Jon Parise (jon at csh.rit.edu) . Information Technology (2001)
http://www.csh.rit.edu/~jon/ : Computer Science House Member
More information about the Python-list
mailing list