def echo_server(handle, error): if error: raise TransportError.from_errno(error) client = self.create_handle() handle.accept(client) protocols[0] = EchoServer() transports[0] = self.create_transport(client, protocols[0], True)
def echo_client(handle, error): if error: raise TransportError.from_errno(error) protocols[1] = ProtocolLogger() trans = transports[1] = self.create_transport(handle, protocols[1], False) trans.write(b'foo\n') trans.write(b'bar\n') trans.writelines([b'qux', b'quux']) if trans.can_write_eof(): trans.write_eof()
def echo_client(handle, error): if error: raise TransportError.from_errno(error) protocols[1] = ProtocolLogger() trans = transports[1] = self.create_transport( handle, protocols[1], False) trans.write(b'foo\n') trans.write(b'bar\n') trans.writelines([b'qux', b'quux']) if trans.can_write_eof(): trans.write_eof()