1

I faced error 98, address already in use problem while I kill an running python TCPServer server and try to re-start it.

I noticed there is other article, suggest to sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) or set TCPServer.allow_reuse_address = True.

But I still faced the same problem, is there any other reason for this?

I am using RedHat EL 6.2, Python 2.6.

Thanks

The code I used was:

TCPServer.allow_reuse_address = True
TCPServer.__init__(self, (gethostname(), self.SERVER_PORT),scheddRequestHandler) 

This keeps on getting me the error 98.

However if I changed to:

TCPServer.allow_reuse_address = True
TCPServer((gethostname(),self.SERVER_PORT),scheddRequestHandler)

The error is gone.

I am not quite clear why this happened?

Community
  • 1
  • 1
Wei
  • 718
  • 1
  • 6
  • 18
  • 1
    Are you killing sockets in a non clean manner? It could be leaving behind resources that would temporarily prevent a reconnection. As Mike said, show code – jdi Jun 18 '12 at 04:39

0 Answers0