def __init__(self, port=7777, host='', on_connect=_on_connect,
            on_disconnect=_on_disconnect, timeout=0.005):
        """
        Create a new Telnet Server.

        port -- Port to listen for new connection on.  On UNIX-like platforms,
            you made need root access to use ports under 1025.

        host -- Address of the LOCAL network interface to listen on.  You
            can usually leave this blank unless you want to restrict traffic
            to a specific network device.  This will usually NOT be the same
            as the Internet address of your server.

        on_connect -- function to call with new telnet connections

        on_disconnect -- function to call when a client's connection dies,
            either through a terminated session or client.active being set
            to False.

        timeout -- amount of time that Poll() will wait from user inport
            before returning.  Also frees a slice of CPU time.
        """

        self.port = port
        self.host = host
        self.on_connect = on_connect
        self.on_disconnect = on_disconnect
        self.timeout = timeout

        server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        server_socket.bind((host, port))
        self.address = server_socket.getsockname()
        server_socket.listen(5)

        self.server_socket = server_socket
        self.server_fileno = server_socket.fileno()

        ## Dictionary of active clients,
        ## key = file descriptor, value = TelnetClient (see miniboa.telnet)
        self.clients = {}
def __init__ ( self , port = 7777 , host = '' , on_connect = _on_connect , on_disconnect = _on_disconnect , timeout = 0.005 ) : self . port = port self . host = host self . on_connect = on_connect self . on_disconnect = on_disconnect self . timeout = timeout server_socket = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) server_socket . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , 1 ) server_socket . bind ( ( host , port ) ) self . address = server_socket . getsockname ( ) server_socket . listen ( 5 ) self . server_socket = server_socket self . server_fileno = server_socket . fileno ( ) self . clients = { }
Create a new Telnet Server.

        port -- Port to listen for new connection on.  On UNIX-like platforms,
            you made need root access to use ports under 1025.

        host -- Address of the LOCAL network interface to listen on.  You
            can usually leave this blank unless you want to restrict traffic
            to a specific network device.  This will usually NOT be the same
            as the Internet address of your server.

        on_connect -- function to call with new telnet connections

        on_disconnect -- function to call when a client's connection dies,
            either through a terminated session or client.active being set
            to False.

        timeout -- amount of time that Poll() will wait from user inport
            before returning.  Also frees a slice of CPU time.