SocketServer Problem

Serdar Soydemir serdars at
Sat Jun 2 13:51:04 CEST 2001


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 . 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:
           self.wfile.write (data + "\r\n")

server=SocketServer.TCPServer( ('',10002), TestHandler)

Serdar Soydemir

More information about the Python-list mailing list