newbie sending hex values over UDP socket

Peter Hansen peter at engcorp.com
Wed Sep 15 18:46:07 EDT 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