Protocols and transports class Echo(Protocol): def dataReceived(self, data): self.transport.write(data) A protocol is a byte-stream Events that can happen to protocols: 'dataReceived', 'connectionMade' and 'connectionLost' Ideally, you'd use an existing protocol implementation in the twisted.protocols package, rather than write your own