def __init__(self, device, host, port, tb_limit=20, logger=log):
        """Initialise the IO server instance.

        Parameters
        ----------
        device : object
            :class:`katcp.DeviceServer`-like KATCP message-eating device
        host : str
            IP to bind the server socket on
        port : int
            Port to listen on
        tb_limit : int, optional
            Maximum traceback length that is sent to clients when an unhandled
            exception is encountered
        logger : :class:`logging.Logger` object, optional
            Logger instance to use for logging, defaults to module log

        API with device
        ===============

        Device methods called
        ---------------------
        All device methods called should be non-blocking. Expects all
        device.on_* methods to return a future that resolves when it is done
        or ready to be called again.

        ready = device.on_client_connect(client_conn)

            client_conn -- ClientConnection-like instance returned by
                           self.client_connection_factory
            ready -- Future that resolves when device is ready to accept messages

        ready = device.on_client_disconnect(client_conn, reason, connection_open)

            client_conn -- as above
            reason -- string reason for disconnect
            connection_open -- True if the connection can still be written to
            ready -- Future that resolves when the connection can be closed

        ready = device.on_message(client_conn, msg)

            client_conn -- as above
            msg -- katcp.Message object representing the most recent message
            ready -- Future that resolves when device is ready to accept another message

        inform = device.create_log_inform(level_name, msg, name, timestamp=None)

            inform -- #log inform message

        Services provided to device
        ===========================

        It is expected that device will use the KATCPServer instance's ioloop.
        Devices would mainly interact using:

        set_ioloop(), start(), stop(), join(), send_message(),
        mass_send_message(), and _from_thread() versions of message sending
        methods. Except for the _from_thread() methods, all calls must be made
        from the ioloop thread.

        """
        self._device = device
        self._bindaddr = (host, port)
        self._tb_limit = tb_limit
        self._logger = logger
        self._parser = MessageParser()
        # Indicate that server is running and ready to accept connections
        self._running = threading.Event()
        # Indicate that we are stopped, i.e. join() can return
        self._stopped = threading.Event()
        self.ioloop = None
        "The Tornado IOloop to use, set by self.set_ioloop()"
        # ID of Thread that hosts the IOLoop.
        # Used to check that we are running in the ioloop.
        self.ioloop_thread_id = None
        # Map from tornado IOStreams to ClientConnection objects
        self._connections = {}
        self._ioloop_manager = IOLoopManager(managed_default=True)
def __init__ ( self , device , host , port , tb_limit = 20 , logger = log ) : self . _device = device self . _bindaddr = ( host , port ) self . _tb_limit = tb_limit self . _logger = logger self . _parser = MessageParser ( ) self . _running = threading . Event ( ) self . _stopped = threading . Event ( ) self . ioloop = None self . ioloop_thread_id = None self . _connections = { } self . _ioloop_manager = IOLoopManager ( managed_default = True )
Initialise the IO server instance.

        Parameters
        ----------
        device : object
            :class:`katcp.DeviceServer`-like KATCP message-eating device
        host : str
            IP to bind the server socket on
        port : int
            Port to listen on
        tb_limit : int, optional
            Maximum traceback length that is sent to clients when an unhandled
            exception is encountered
        logger : :class:`logging.Logger` object, optional
            Logger instance to use for logging, defaults to module log

        API with device
        ===============

        Device methods called
        ---------------------
        All device methods called should be non-blocking. Expects all
        device.on_* methods to return a future that resolves when it is done
        or ready to be called again.

        ready = device.on_client_connect(client_conn)

            client_conn -- ClientConnection-like instance returned by
                           self.client_connection_factory
            ready -- Future that resolves when device is ready to accept messages

        ready = device.on_client_disconnect(client_conn, reason, connection_open)

            client_conn -- as above
            reason -- string reason for disconnect
            connection_open -- True if the connection can still be written to
            ready -- Future that resolves when the connection can be closed

        ready = device.on_message(client_conn, msg)

            client_conn -- as above
            msg -- katcp.Message object representing the most recent message
            ready -- Future that resolves when device is ready to accept another message

        inform = device.create_log_inform(level_name, msg, name, timestamp=None)

            inform -- #log inform message

        Services provided to device
        ===========================

        It is expected that device will use the KATCPServer instance's ioloop.
        Devices would mainly interact using:

        set_ioloop(), start(), stop(), join(), send_message(),
        mass_send_message(), and _from_thread() versions of message sending
        methods. Except for the _from_thread() methods, all calls must be made
        from the ioloop thread.