Problems using SocketServer.ThreadingTCPServer

Joseph A Knapka jknapka at earthlink.net
Thu Jan 31 10:18:55 EST 2002


Joao Prado Maia wrote:
> 
> > -----Original Message-----
> > From: Joseph A Knapka [mailto:jknapka at earthlink.net]
> > Sent: Thursday, January 31, 2002 10:51 AM
> > To: python-list at python.org
> > Subject: Re: Problems using SocketServer.ThreadingTCPServer
> >
> >
> > Joao Prado Maia wrote:
> > >
> > > Well, correct me if I'm wrong but if OE is dropping the
> > connection, isn't
> > > SocketServer.ThreadingTCPServer' job to call the correct
> > method on my class
> > > ?
> >
> > I'm not completely sure, but I think it's your job to detect
> > end-of-connection in your handle() method and return. The
> > TCPServer, I believe, just does:
> >
> >     rqh = YourRequestHandlerClass(...)
> >     rqh.setup()
> >     rqh.handle()
> >     rqh.finish()
> >
> 
> Well yes, but I'm already doing that on the line that does a 'continue' on
> the loop, which breaks the loop (yes, I realize I should just 'break' it ;)
> and returns from the handle() function.

Since you've already strip()'d the line when you get to
that test, you may be breaking the connection when OE has
*not* closed it. Maybe the problem is OE having to continually
reconnect? Which is possibly what you said in your original
message, and I missed it. Also, I have to apologize for
not giving your code a closer reading before trying to
answer your question. But I think to be completely safe,
you must check for line=='' *before* calling strip(),
or test for self.inputline=='', instead of line==''.

Cheers,

-- Joe
"I should like to close this book by sticking out any part of my neck
 which is not yet exposed, and making a few predictions about how the
 problem of quantum gravity will in the end be solved."
 --- Physicist Lee Smolin, "Three Roads to Quantum Gravity"




More information about the Python-list mailing list