start making server

This commit is contained in:
lickthecheese 2020-03-11 11:43:39 -04:00
parent d536d076b6
commit 7514694ba7
1 changed files with 10 additions and 5 deletions

View File

@ -2,15 +2,20 @@
from twisted.internet import protocol, reactor, endpoints
class Echo(protocol.Protocol):
class Reply(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
data = str(data).split(':')
if len(data) > 3:
output = "yes"
else:
output = 'ERROR:INVALID_INP'
self.transport.write('LICKTHECOINS:{}\n'.format(output).encode('utf-8'))
class EchoFactory(protocol.Factory):
class Factory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
return Reply()
endpoints.serverFromString(reactor, "tcp:13327").listen(EchoFactory())
endpoints.serverFromString(reactor, "tcp:13327").listen(Factory())
reactor.run()