1 # Clebson Derivan ( cderivan@gmail.com ) 2 # fixTestBot - provides FIX protocol bussiness level test automation. 3 4 # twisted imports 5 import sys 6 from twisted.internet import reactor, protocol 7 from twisted.python import log 8 9 class Protocol(protocol.Protocol): 10 def connectionMade(self): 11 self.transport.write("Twisted server v000\r\n") 12 print "We are connected" 13 14 def dataReceived(self, raw): 15 print "msg received: ", raw 16 17 class Factory(protocol.ReconnectingClientFactory): 18 19 def buildProtocol(self, addr): 20 self.resetDelay() 21 return Protocol() 22 23 if __name__ == "__main__": 24 25 log.startLogging(sys.stdout) 26 27 f = Factory() 28 reactor.connectTCP( "127.0.0.1", 9000, f ) 29 reactor.run() 30