All pastes #451201 Raw Edit

Cody Brocious

public python v1 · immutable
·published 2007-04-21 09:50 UTC
rendered paste body
class Telnet(Node):    def __init__(self, host, port):        self.console = self.Factory.Console()                tcp = self.Factory.Network.TCP                try:            self.sock = tcp.Client(host, port)        except tcp.ClientException:            return                self.running = True                self.factory.Thread.New(self.Reader, ())        self.factory.Thread.New(self.Writer, ())        def Stop(self):        self.running = False        def Reader(self):        while self.running:            try:                data = self.console.read()            except:                self.Stop()                break                        self.sock.write(data)        def Writer(self):        while self.running:            try:                data = self.sock.read(65536)            except:                self.Stop()                break                        self.console.write(data)