This is my code `
class TestProtocol(Protocol):
def connectionMade(self):
print 'Got connection from', self.transport.client
def dataReceived(self, data):
print(data)
class Test(Factory, HoneypotService):
NAME = 'test'
protocol = TestProtocol
def __init__(self, config=None, logger=None):
HoneypotService.__init__(self, config=config, logger=logger)
self.port = 8888
def getService(self):
return internet.TCPServer(self.port, self)
When I use the telnet 127.0.0.1 8888
command to connect to this service, and input abcdef
,Method dataReceived is executed twice,execute result is as follows:
output picture: enter image description here
Is there any way to execute dataReceived only once, And the output information is abcdef
.
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
The output information is abcdef
.