twisted service as client
hoi zäme ich möchte mit twistd einen client-service erstellen erstellen der regelmässig mit einem twisted server daten tauscht. wenn ich den client-service als eigenständige app starte, habe ich folgende sequenz: factory = MyClientFactory("ws://%s:%s" % (EXPANDERSERVERIP, EXPANDERSERVERPORT), debug = True) factory.protocol = MyClientProtocol c = reactor.connectTCP(EXPANDERSERVERIP, EXPANDERSERVERPORT, factory) reactor.run() nun möchte ich das selbe als twisted service machen: dazu habe ich folgenden code: class EchoClient(service.Service): def __init__(self, port = EXPANDERSERVERPORT, debug = False): # shoud self.port = port self.debug = debug def startService(self): from twisted.internet import reactor factory = MyClientFactory("ws://%s:%s" % (EXPANDERSERVERIP, EXPANDERSERVERPORT), debug = False) factory.protocol = MyClientProtocol #EchoServerProtocol # factory.debug = self.debug self.factory = factory reactor.connectTCP(EXPANDERSERVERIP, EXPANDERSERVERPORT, factory) nur scheint hier reactor.run() zu fehlen. Jedenfalls wird mein service nicht aktiviert. besten dank für eure tips. gruss robert
hoi zäme problem gelöst aufgrund eines Fehlers in meinem code, wurde der server zwar gestarted, brach sofort ab und wurde von thwisd wieder gestarted .. .. danke robert On 20.01.2015 20:34, robert rottermann wrote:
hoi zäme
ich möchte mit twistd einen client-service erstellen erstellen der regelmässig mit einem twisted server daten tauscht.
wenn ich den client-service als eigenständige app starte, habe ich folgende sequenz:
factory = MyClientFactory("ws://%s:%s" % (EXPANDERSERVERIP, EXPANDERSERVERPORT), debug = True) factory.protocol = MyClientProtocol
c = reactor.connectTCP(EXPANDERSERVERIP, EXPANDERSERVERPORT, factory) reactor.run()
nun möchte ich das selbe als twisted service machen: dazu habe ich folgenden code:
class EchoClient(service.Service):
def __init__(self, port = EXPANDERSERVERPORT, debug = False): # shoud self.port = port self.debug = debug
def startService(self): from twisted.internet import reactor factory = MyClientFactory("ws://%s:%s" % (EXPANDERSERVERIP, EXPANDERSERVERPORT), debug = False) factory.protocol = MyClientProtocol #EchoServerProtocol # factory.debug = self.debug
self.factory = factory
reactor.connectTCP(EXPANDERSERVERIP, EXPANDERSERVERPORT, factory)
nur scheint hier reactor.run() zu fehlen. Jedenfalls wird mein service nicht aktiviert.
besten dank für eure tips.
gruss robert
_______________________________________________ python-de maillist - python-de@python.org https://mail.python.org/mailman/listinfo/python-de
participants (1)
-
robert rottermann