From 619b4282c65ae3130096f4eb8bc77bf37093bf09 Mon Sep 17 00:00:00 2001 From: Nafis Faysal <7595238+nafisfaysal@users.noreply.github.com> Date: Tue, 12 Jun 2018 00:47:28 +0600 Subject: [PATCH 1/2] fix wrong importer and fixed bug for python client --- Client/Python/Calc_Client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Client/Python/Calc_Client.py b/Client/Python/Calc_Client.py index e8439bf..d296306 100644 --- a/Client/Python/Calc_Client.py +++ b/Client/Python/Calc_Client.py @@ -3,10 +3,11 @@ import grpc import Calc_pb2 +import Calc_pb2_grpc def run(): channel = grpc.insecure_channel('localhost:50050') - stub = Calc_pb2.CalculatorStub(channel) + stub = Calc_pb2_grpc.CalculatorStub(channel) response = stub.Add(Calc_pb2.AddRequest(n1=20,n2=10)) print(response.n1) response = stub.Substract(Calc_pb2.SubstractRequest(n1=20,n2=10)) From d0e93cff331c40dea2a65ba48958379d9c042e75 Mon Sep 17 00:00:00 2001 From: Nafis Faysal <7595238+nafisfaysal@users.noreply.github.com> Date: Tue, 12 Jun 2018 00:49:39 +0600 Subject: [PATCH 2/2] fix bug for python server --- Server/Calc_Server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Server/Calc_Server.py b/Server/Calc_Server.py index 2cb9c91..9e45b52 100644 --- a/Server/Calc_Server.py +++ b/Server/Calc_Server.py @@ -4,11 +4,12 @@ import grpc import Calc_pb2 +import Calc_pb2_grpc _ONE_DAY_IN_SECONDS = 60 * 60 * 24 -class Calculator(Calc_pb2.CalculatorServicer): +class Calculator(Calc_pb2_grpc.CalculatorServicer): def Add(self, request, context): return Calc_pb2.AddReply(n1=request.n1+request.n2) @@ -25,7 +26,7 @@ def Divide(self, request, context): def serve(): server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) - Calc_pb2.add_CalculatorServicer_to_server(Calculator(), server) + Calc_pb2_grpc.add_CalculatorServicer_to_server(Calculator(), server) server.add_insecure_port('[::]:50050') server.start() try: @@ -35,4 +36,4 @@ def serve(): server.stop(0) if __name__ == '__main__': - serve() \ No newline at end of file + serve()