def main(args): listener = Listener() listener.append_service(RemoteErrorImpl()) channel = ServerChannel(PBHandler(listener)) channel.listen(args.address) channel.start() pymaid.serve_forever()
def main(): listener = Listener() listener.append_service(RemoteErrorImpl()) channel = ServerChannel(PBHandler, listener, parser=PBParser) channel.listen(("127.0.0.1", 8888)) channel.start() pymaid.serve_forever()
def main(args): listener = Listener() listener.append_service(HelloServiceImpl()) channel = ServerChannel(PBHandler(listener)) # channel.listen(('localhost', 8888)) channel.listen(args.address) channel.start() try: serve_forever() except Exception: print(len(channel.connections)) print(greenlet_pool.size, len(greenlet_pool.greenlets))
def main(): listener = Listener() listener.append_service(HelloServiceImpl()) channel = ServerChannel(PBHandler, listener, parser=PBParser) #channel.listen(('localhost', 8888)) channel.listen('/tmp/hello_pb.sock') channel.start() try: serve_forever() except: print(len(channel.connections)) print(greenlet_pool.size, len(greenlet_pool.greenlets))
def main(): listener = Listener() listener.append_service(ChatServiceImpl()) channel = ServerChannel(PBHandler, listener, parser=PBParser) channel.listen(("127.0.0.1", 8888)) channel.start() try: pymaid.serve_forever() except: import traceback traceback.print_exc() print(len(channel.connections)) print(greenlet_pool.size, len(greenlet_pool.greenlets))
def main(args): listener = Listener() listener.append_service(ChatServiceImpl()) channel = ServerChannel(PBHandler(listener)) channel.listen(args.address) channel.start() try: pymaid.serve_forever() except Exception: import traceback traceback.print_exc() print(len(channel.connections)) print(greenlet_pool.size, len(greenlet_pool.greenlets))
def cleanup(): for conn in connections: service.Leave(conn=conn) conn.close() def wrapper(conn, n, total, message=message): for x in range(n): service.Publish(request, conn=conn) while conn.count != total: sleep(0.001) listener = Listener() listener.append_service(ChatBroadcastImpl()) channel = BidChannel(PBHandler, listener, parser=PBParser) connections = [] service = ServiceStub(ChatService_Stub(None)) method = service.stub.DESCRIPTOR.FindMethodByName('Publish') request = service.stub.GetRequestClass(method)(message=message) def main(): pool = Pool() concurrency, times = 100, 100 total = concurrency * times for x in range(concurrency): pool.spawn(prepare) pool.join()