Exemple #1
0
    def __init__ (self,
        host = None,
        port = 23,
        readCallback = None,
        stateCallback = None,
    ):
        """Create a telnet connection.

        Inputs:
            readCallback: function to call whenever a line of data is read;
                it will be sent one argument: the line of data
            stateCallback: function to call whenever the socket
                connects or disconnected; it will be sent two arguments:
                    is connected flag (true if connected, false if not)
                    this connection object      
        """
        TCPConnection.__init__(self,
            host=host,
            port=port,
            readCallback=readCallback,
            stateCallback=stateCallback,
            readLines = True,
            authReadCallback = self._authRead,
            authReadLines = False,
        )
        
        self._initData()
Exemple #2
0
    def __init__ (self,
        host = None,
        port = 9877,
        readCallback = None,
        stateCallback = None,
        loginExtra = None,
        name = "",
    ):
        """Create a hub connection, but do not connect

        Inputs:
        - host: default TCP address of host (can override when connecting)
        - port: default TCP port (can override when connecting);
            defaults to 9877, the standard hub port
        - readCallback: function to call whenever a line of data is read;
          it will be sent two arguments: (self, readData);
          the read data does not include the line terminator
        - stateCallback: function to call whenever the state of the connection changes;
          it will be sent one argument: self
        - loginExtra: additional string to be sent with the login command.
        """
        TCPConnection.__init__(self,
            host=host,
            port=port,
            readCallback = readCallback,
            readLines = True,
            stateCallback = stateCallback,
            authReadCallback = self._authRead,
            authReadLines = True,
            name = name,
        )
        self._initData()
        self._loginExtra = loginExtra
Exemple #3
0
    def __init__(
        self,
        host=None,
        port=9877,
        readCallback=None,
        stateCallback=None,
        loginExtra=None,
        name="",
    ):
        """Create a hub connection, but do not connect

        Inputs:
        - host: default TCP address of host (can override when connecting)
        - port: default TCP port (can override when connecting);
            defaults to 9877, the standard hub port
        - readCallback: function to call whenever a line of data is read;
          it will be sent two arguments: (self, readData);
          the read data does not include the line terminator
        - stateCallback: function to call whenever the state of the connection changes;
          it will be sent one argument: self
        - loginExtra: additional string to be sent with the login command.
        """
        TCPConnection.__init__(
            self,
            host=host,
            port=port,
            readCallback=readCallback,
            readLines=True,
            stateCallback=stateCallback,
            authReadCallback=self._authRead,
            authReadLines=True,
            name=name,
        )
        self._initData()
        self._loginExtra = loginExtra