I am using a python chat room server from this code but I am having a issue in running with the client's exceptional behaviour, my server hangs and stops working when my Android client switches to another network and then switches back to chat server network. first I get the error
error is [Errno 131] Connection reset by peer
and then
error: [Errno 9] Bad file descriptor
I want to handle this in my Chat server code and keep it up running always either client connects or disconnects, the detailed exception is
---------------------------------------------
error is [Errno 131] Connection reset by peer
---------------------------------------------
Exception happened during processing of request from ('192.168.2.46', 43160)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/home/rahulm/datagroup.py", line 242, in finish
self.roomcast('\n %s has disconnected *\n' % self)
File "/home/rahulm//datagroup.py", line 341, in roomcast
listener.request.send(data)
error: [Errno 32] Broken pipe
----------------------------------------
error is [Errno 9] Bad file descriptor
----------------------------------------
Exception happened during processing of request from ('192.168.2.63', 40460)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/mnt/usb/PirateBox/Shared/datagroup.py", line 242, in finish
self.roomcast('\n %s has disconnected *\n' % self)
File "/mnt/usb/PirateBox/Shared/datagroup.py", line 341, in roomcast
listener.request.send(data)
File "/usr/local/lib/python2.7/socket.py", line 170, in _dummy
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
----------------------------------------
Note:- I am running chat server in the embedded device So I cant use Twisted any help most appreciated. Thanks in Advance !!!