SocketServer Problem
Serdar Soydemir
serdars at ixir.com
Sat Jun 2 07:51:04 EDT 2001
Hello,
I am working on a little socket server application to learn and practice how
Python socketserver works. It works great for now, but it can accept only
one connection , when i try to open another conn while first one is still
alive, it sends the last one to some kind of queue and when first one drops,
this one becomes active immediately.
What i want to learn is how can I tell SocketServer to serve for multiple
connections? I changed allow_reuse_address directive to "1" and queue value
is equal to "5" in SocketServer.py . I also tried to manipulate
allow_reuse_address from my code, but it still doesn't accept multiple
connections. Here's a little portion of my code:
*********
class TestHandler(SocketServer.StreamRequestHandler):
def handle(self):
import string
self.wfile.write ("hello\r\n")
while 1:
data=self.rfile.readline(512)
data=string.strip(data)
self.wfile.write (data + "\r\n")
server=SocketServer.TCPServer( ('',10002), TestHandler)
server.serve_forever()
*********
--
Serdar Soydemir
More information about the Python-list
mailing list