def __init__(
         self,
         msg_handler=MessageHandler(),
         deserializer=Deserializer(),
         msg_parser=MsgParser(),
 ):
     # self._data_recv = b'',
     self._msg_handler = msg_handler  # ????????????
     self._desialiser = deserializer
     self._msg_parser_py = msg_parser
    def __init__(self, name, msgHandler, server_ip, server_port):
        self.server = None
        self.name = name
        self.serverIp = server_ip
        self.serverPort = server_port
        self.msgHandler = msgHandler

        self.parser = MsgParser()
        self.thread = None
        self.run = True
        self.running = False
Exemple #3
0
 def _run(self):
     self.server.bind(('0.0.0.0', self.port))
     self.server.listen(self.port)
     while self.run:
         ready = select.select([self.server], [], [], 1)
         if not ready[0]:
             continue
         conn, addr = self.server.accept()
         self.connections[conn] = {'addr': addr, 'parser': MsgParser()}
         print(addr, " connected")
         thread = threading.Thread(target=self.clientThread, args=(conn, ))
         thread.start()