Created
November 1, 2019 10:47
-
-
Save Cartmanishere/59a2602b867b7953133590d7654e77e4 to your computer and use it in GitHub Desktop.
Python server implementation for grpc-python-golang example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def serve(port): | |
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) | |
add_KeywordServiceServicer_to_server( | |
NltkService(), server) | |
server.add_insecure_port('[::]:' + str(port)) | |
server.start() | |
print("Listening on port {}..".format(port)) | |
try: | |
while True: | |
time.sleep(10000) | |
except KeyboardInterrupt: | |
server.stop(0) | |
if __name__== "__main__": | |
serve(6000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Pranav,
Thanks so much for your help explaining basics of gRPC. It was a great challenge for me (Setting up Go workspace...), but finally it works. Thanks!