SocketServer Problem 
Author Message
 SocketServer Problem

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



Wed, 19 Nov 2003 19:51:04 GMT  
 SocketServer Problem
Sorry for my inattention, i found the answer, changing simply TCPServer to
ThreadingTCPServer solved the problem.

--
Serdar Soydemir

Quote:
----- Original Message -----


Sent: Saturday, June 02, 2001 2:51 PM
Subject: SocketServer Problem

> 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



Wed, 19 Nov 2003 20:41:23 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problems using SocketServer.ThreadingTCPServer

2. Problem in multithreading Socketserver explained (should appl y to *nix, too)

3. Problem in multithreading Socketserver explained (should apply to *nix, too)

4. problems with SocketServer rfile.read()

5. problem with SocketServer -- address already in use

6. _socket / SocketServer / Mandrake Linux problem / Python 2.3

7. SocketServer class - basis problem

8. Problem using SocketServer.ThreadingTCPServer on Windows?

9. Threads and socketservers... (xmlrpc)

10. SocketServer.DatagramRequestHandler.setup bug?

11. SocketServer

12. SocketServer module (newbie)

 

 
Powered by phpBB® Forum Software