need a thread to keep a socket connection alive?
Rene Pijlman
reply.in.the.newsgroup at my.address.is.invalid
Mon Apr 24 15:12:36 EDT 2006
nephish at xit.net:
>i have discovered that the server will send a request for the heartbeat
>ping if its almost timed out, so i use the length of the message to
>determine what to do with it.
>
>msg = sockobj.recv(1024)
>
>if len(msg) == 158:
> record the data
>elif len(msg) == (34): # length of request for ping
> ping the server
Incorrect. There are no 'messages' with TCP, only bytes.
--
René Pijlman
More information about the Python-list
mailing list