Interact with the socket. This will send all keyboard input to the
        socket and input from the socket to the console until an EOF occurs.

def interact(self):
        """
        Interact with the socket. This will send all keyboard input to the
        socket and input from the socket to the console until an EOF occurs.
        """

        sockets = [sys.stdin, self.channel]
        while True:
            ready = select.select(sockets, [], [])[0]

            if sys.stdin in ready:
                line = sys.stdin.readline().encode('latin1')
                if not line:
                    break
                self.write(line)

            if self.channel in ready:
                self.read(1, echo=True)