예제 #1
0
 def main(self):
     trns = DuplexStreamTransport(self.reactor.io.stdin, self.reactor.io.stdout)
     server = RemotingHandler(self.Service, trns)
     try:
         yield server.start()
     finally:
         self.reactor.stop()
예제 #2
0
 def main(self):
     trns = DuplexStreamTransport(self.reactor.io.stdin,
                                  self.reactor.io.stdout)
     server = RemotingHandler(self.Service, trns)
     try:
         yield server.start()
     finally:
         self.reactor.stop()
예제 #3
0
def main(reactor):
    reactor.jobs.schedule(10, reactor.stop)
    server = yield reactor.net.serve(RemotingHandler.of(MyService), 18822)
    client = yield RemotingClient.connect(reactor, "localhost", 18822)
    print client
    res = yield client.call("add", 33, 22)
    print "res is", res
    res = yield client.call("div", 33.0, 22.0)
    print "res is", res
    res = yield client.api.add(33, 22)
    print "res is", res

    try:
        res = yield client.call("div", 33, 0)
    except ZeroDivisionError:
        print "OK: got exception"
    else:
        print "Error: did not get an exception!"
예제 #4
0
def main(reactor):
    reactor.jobs.schedule(10, reactor.stop)
    server = yield reactor.net.serve(RemotingHandler.of(MyService), 18822)
    client = yield RemotingClient.connect(reactor, "localhost", 18822)
    print client
    res = yield client.call("add", 33, 22)
    print "res is", res
    res = yield client.call("div", 33.0, 22.0)
    print "res is", res
    res = yield client.api.add(33, 22)
    print "res is", res
    
    try:
        res = yield client.call("div", 33, 0)
    except ZeroDivisionError:
        print "OK: got exception"
    else:
        print "Error: did not get an exception!"