Esempio n. 1
0
 def __init__(self, host: str, port: int, username: str):
     """Sets up the client, connects and logs into the server"""
     Client.__init__(self, host, port)
     self.location_queue = Queue()
     self.health_queue = Queue()
     self.connect()
     self.login(username)
     self._user = username
Esempio n. 2
0
 def __init__(self, address, port, name, role, list, logincallback, insertcallback, disconnectcallback):
     """
     :param address: address of the network
     :param port: port of the network
     :param name: username for the login
     :param role: role for the login ("master" or "client")
     :param list: StrategiesList object from the StrategiesFrame (for updating its database)
     :param logincallback: Callback to call when login succeeds
     :param insertcallback: Callback to call when a command is received
     :param disconnectcallback: Callback to call when disconnect occurs
     """
     Client.__init__(self, address, port)
     # Queue to send True to if exit is requested
     self.logged_in = False
     self.name = name
     # Role may be Master or Client instead of master or client
     self.role = role.lower()
     self.list = list
     self.exit = False
     self.login_callback = logincallback
     self.insert_callback = insertcallback
     self.disconnect_callback = disconnectcallback