how to send an int over a socket

Pierre Quentel quentel.pierre at wanadoo.fr
Fri Feb 4 23:51:10 EST 2005


Use string formatting :

msglen = '%16s' %len(testmessage)

will return a 16-byte string, beginning with spaces. Send it over your 
connection and use int() to get the message length

Pierre



More information about the Python-list mailing list