예제 #1
0
 def receive(self, client, addr):
     while self.receiving:
         try:
             data = utilities.recv_data(client)
             if data:
                 self.handle_data(addr, data)
             else:
                 logging.error("Client " + addr + " disconnected")
         except:
             client.close()
             logging.error("Unexpected exception. Client connection to " + addr + " closed.")
             # TODO remove from connections
             # TODO should try reconnecting?
     client.close()
예제 #2
0
 def receive(self, client, addr):
     logging.info("Start receiving data.")
     while self.receiving:
         try:
             data = utilities.recv_data(client)
             if data:
                 self.handle_data(addr, data)
             else:
                 logging.error("Client " + addr + " disconnected")
         except RuntimeError:
             client.close()
             logging.error("Server socket connection to " + addr + " broken.")
             # TODO remove from connections
             # TODO should try reconnecting?
         except:
             client.close()
             logging.error("Unexpected exception. Server connection to " + addr + " closed.")
             # TODO remove from connections
             # TODO should try reconnecting?
     client.close()