newbie sending hex values over UDP socket

Peter Hansen peter at engcorp.com
Thu Sep 16 00:46:07 CEST 2004


Bill Seitz wrote:

> Current stump in this area: taking current time (time.time()) and
> delivering as 4-byte blob.
> 
>>>>t= int(time.time())
>>>>format = 'l'
>>>>struct.pack(format,t)
> 
> '\x10\xb7HA'

What's wrong with this one?  Note that it is a 4-byte
blob, as requested.  You can always check that with
len(s).  In this case, len('\x10\xb7HA') == 4.

-Peter



More information about the Python-list mailing list