Hi, Is there an example showing how a single async client process can talk to multiple async servers in c++.
>From the example located at https://github.com/grpc/grpc/blob/v1.15.0/examples/cpp/helloworld/greeter_async_client2.cc it looks like one has to create separate channel and hence stub for each server. Also a second thread needs to be created so that it can asynchronously process the responses coming from second server. // Instantiate the client. It requires a channel, out of which the actual RPCs // are created. This channel models a connection to an endpoint (in this case, // localhost at port 50051). We indicate that the channel isn't authenticated // (use of InsecureChannelCredentials()). GreeterClient greeter(grpc::CreateChannel( "localhost:50051", grpc::InsecureChannelCredentials())); * GreeterClient greeter1(grpc::CreateChannel(* * "localhost:60051", grpc::InsecureChannelCredentials())); ================> channel for the second server.* // Spawn reader thread that loops indefinitely std::thread thread_ = std::thread(&GreeterClient::AsyncCompleteRpc, &greeter); * std::thread thread_ = std::thread(&GreeterClient::AsyncCompleteRpc, &greeter1);** ================> process messages coming for the second server.* Is this is right way OR same can be done using single thread to handle messages coming from two server. In other words, can same channel/stub & completion queue be used for two different servers and is there a way to demux the messages coming from different servers on single channel ? Thanks, Siddhesh. -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/3ae6ab9b-c332-4e56-a037-95c363b8a4eb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
