gRPC-haskell/examples/echo/echo-python/echo_server.py
Connor Clark ce56953b24 Various example/benchmarking code (#16)
* initial echo client/server examples

* registered and unregistered versions of the example client

* ignore pyc files

* cpp echo code, flag to build examples

* threaded server example
2016-06-03 10:34:09 -07:00

20 lines
462 B
Python

from grpc.beta import implementations
import echo_pb2
import time
class Echo(echo_pb2.BetaEchoServicer):
def DoEcho(self, request, context):
return echo_pb2.EchoRequest(message=request.message)
def main():
server = echo_pb2.beta_create_Echo_server(Echo())
server.add_insecure_port('[::]:50051')
server.start()
try:
time.sleep(600)
except KeyboardInterrupt:
server.stop(0)
if __name__ == '__main__':
main()