Multiple clients connected to a single server gRPC-java

Viewed 30

I'm trying to build a server that has 6 clients connected with gRPC-java. My question is, how do I do to have this 6 clients connected to a single server? Does anyone can send me an example of how I do that?

Thanks :)

1 Answers

Fundamentally the process is not that different between having one client connect to a server vs. six. The gRPC server is multithreaded and will simultaneously accept connections from multiple clients.

You can quickly try this out with the hello world example. You can first run the Greeter server in the example and then start six different client processes at the same time. They should all connect to the server and execute the server side code.

In case you are thinking of six long running persistent connections, you might be interested in a streaming RPC. The basic tutorial can get you started with those.

Related