Skip to content

Instantly share code, notes, and snippets.

@abhigenie92
Last active April 6, 2016 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhigenie92/f86039a655f218493c579ea4a7296981 to your computer and use it in GitHub Desktop.
Save abhigenie92/f86039a655f218493c579ea4a7296981 to your computer and use it in GitHub Desktop.
# stroke_client.py
from twisted.internet.protocol import Protocol, ClientFactory
class StrokeClientFactory(ClientFactory):
def buildProtocol(self, addr):
return StrokeClient(self)
class StrokeClient(Protocol):
def __init__(self, factory):
self. factory = factory
self.recv_data=''
def connectionMade(self):
print "Connected to remote server"
def dataReceived(self,data):
pass
=============================================
from stroke_client import StrokeClientFactory
self.stroke_conn=reactor.connectTCP(server_addr_ip_addr,self.stroke_port,StrokeClientFactory())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment