gRPC does not return the target name (this is something the user/application should keep track of when creating the channel).
however, the ClientContext::Peer() would return you the address of the exact backend the Call went to.. (https://grpc.io/grpc/cpp/classgrpc_1_1_client_context.html#ad1f00ff321b1c2823d5e2f61cb0852ca) -Sree On Monday, April 30, 2018 at 9:27:42 AM UTC-7, [email protected] wrote: > > Hi, I would like to just obtain the information of the server I connected > to here is how my functionality is being used: > > ProjectGuideClient > client(grpc::CreateChannel(server,grpc::InsecureChannelCredentials())); > client.Dele(args); > > If I return back a not ok status I would like to connect to a master node > and retrieve the back up server to connect to. To do this I need to send > the server that I want the back up to. In this case I need to obtain the > variable "server" as shown in above. where can I access this information? > and how. below there are questions marks of how I would to use it and I > thought I could get the information? Thanks!! > > /* > Dele rpc command > Parms string row, string col > Returns true if deleted, false if an error > */ > bool ProjectGuideClient::Dele(DeleArgs args) { > > DeleResponse response; > > ClientContext context; > > Status status = stub_->Dele(&context, args, &response); > if(status.ok()) > return status.ok(); > else{ > //get my channel to senda rewuest for backup > my channel = "Channel.Target(); ??????? > > } > } > -- 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/c8f9040c-ed89-44d2-82c6-91b43bf6ebab%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
