use twisted example code

This commit is contained in:
lickthecheese 2020-03-10 23:13:56 -04:00
parent 738595d77c
commit d536d076b6
1 changed files with 16 additions and 0 deletions

16
server.py Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
from twisted.internet import protocol, reactor, endpoints
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
class EchoFactory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
endpoints.serverFromString(reactor, "tcp:13327").listen(EchoFactory())
reactor.run()