One more socket programming question

Tim Roberts timr at probo.com
Wed Jun 18 03:19:27 EDT 2008


John Salerno <johnjsal at gmailNOSPAM.com> wrote:
>
>I'm now experimenting with the SocketServer class. Originally I 
>subclassed the StreamRequestHandler to make my own custom handler, but a 
>result of this seems to be that the client socket closes after it has 
>been used, instead of staying open.

Right.  "handle" is not called for one REQUEST at a time, it's called for
one CONNECTION at a time.  If you need a connection to be persistent, then
your handle() function needs to sit in a loop making recv calls until you
detect that the conversation is complete.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list