(self, config)
Make a new connection.
Make a new connection.
Make a new connection .
def __init__(self, config):
        if not config["port"]:
            config["port"] = 55000

        """Make a new connection."""
        self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        if config["timeout"]:
            self.connection.settimeout(config["timeout"])

        self.connection.connect((config["host"], config["port"]))

        payload = b"\x64\x00" \
                  + self._serialize_string(config["description"]) \
                  + self._serialize_string(config["id"]) \
                  + self._serialize_string(config["name"])
        packet = b"\x00\x00\x00" + self._serialize_string(payload, True)

        logging.info("Sending handshake.")
        self.connection.send(packet)
        self._read_response(True)
def __init__ ( self , config ) : if not config [ "port" ] : config [ "port" ] = 55000 self . connection = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) if config [ "timeout" ] : self . connection . settimeout ( config [ "timeout" ] ) self . connection . connect ( ( config [ "host" ] , config [ "port" ] ) ) payload = b"\x64\x00" + self . _serialize_string ( config [ "description" ] ) + self . _serialize_string ( config [ "id" ] ) + self . _serialize_string ( config [ "name" ] ) packet = b"\x00\x00\x00" + self . _serialize_string ( payload , True ) logging . info ( "Sending handshake." ) self . connection . send ( packet ) self . _read_response ( True )