<s> from test_pb2 import * <EOL> from protobufrpc . synchronous import TcpServer <EOL> class TestService ( Test ) : <EOL> def Echo ( self , rpc_controller , request , done ) : <EOL> response = EchoResponse ( ) <EOL> response . text = request . text <EOL> done ( response ) <EOL> def Ping ( self , rpc_controller , request , done ) : <EOL> response = PingResponse ( ) <EOL> done ( response ) <EOL> class MathService ( Math ) : <EOL> def Add ( self , rpc_controller , request , done ) : <EOL> response = MathResponse ( ) <EOL> response . result = request . first + request . second <EOL> done ( response ) <EOL> def Multiply ( self , rpc_controller , request , done ) : <EOL> response = MathResponse ( ) <EOL> response . result = request . first * request . second <EOL> done ( response ) <EOL> testService = TestService ( ) <EOL> mathService = MathService ( ) <EOL> server = TcpServer ( ( "<STR_LIT:localhost>" , <NUM_LIT> ) , testService , mathService ) <EOL> server . serve_forever ( ) </s>
