need a thread to keep a socket connection alive?

Roy Smith roy at panix.com
Mon Apr 24 13:45:47 EDT 2006


<nephish at xit.net> wrote:
>elif len(msg) == (34): # length of request for ping
>    ping the server

This seems really dangerous.  You are obviously writing to some
already defined (and hopefully, documented) protocol.  What does the
protocol spec say about ping request messages?

I would be very surprised if the spec says that a ping request is
defined as any message which is 34 bytes long.  More likely, it says
something like, "A ping request is defined by the command code being
set to 5" or something like that.  That's what you should be testing,
not the length of the message.



More information about the Python-list mailing list