Problems using SocketServer.ThreadingTCPServer

Steve Holden sholden at
Fri Feb 1 00:49:31 CET 2002

"Joao Prado Maia" <JMaia at> wrote in message
news:mailman.1012513706.23308.python-list at
[discussion of socket server problems]
> >
> That doesn't fix the problem. Outlook Express doesn't send spaces when the
> problem starts happening, it really does send 'empty' lines. Not even a
> '\r\n' is sent, just a nulled string (or whatever you want to call it ;).
Well, Outlook Express has to be sending something. If a socket recv() call
returns zero bytes then that's the end of the connection, and the server
should give the handler and end of file condition on the socket-based file.

Since it doesn't, we have to assume that something is being stripped off
those lines.

> In any case, what is the purpose for an infinite stream of empty lines
> OE keeps sending thru the socket at what appears like random intervals of
> time ? It really seems like I'm doing something wrong on my little server
> that doesn't account for this situation. Like I said on my original email,
> there are several similar projects of Usenet servers that never
> what I'm experiencing now with Outlook Express. This is why I suspect the
> problem is related to something in my code.
Could be some sort of keep-alive technique to avoid connection timeouts, I
really don't know.

> If you want to take a look on the real code again, please do so below:
I would consider replacing handle()'s

            if __DEBUG__:
                print self.inputline.strip()


            if __DEBUG__:
                print repr(self.inputline)

That way you can see more detail on what's coming in to help you decide
where the problem might lie. This one will run and run ... good luck. These
things can be a real PITA to track down and stomp on. I can almost guarantee
you'll smack your head when you find it.

Consulting, training, speaking:
Python Web Programming:

More information about the Python-list mailing list