grpc / grpc/grpc-dotnet

Grpc client with host and port information

Open
#2,247 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
4.5k
Forks
836
Avg merge
6d 3h
Merged PRs (30d)
7

Description

hi,

This question has already been asked [here](https://github.com/grpc/grpc/issues/34073)

Does the Grpc client have additional methods or properties to get the server name, port number of the server. Like, I can see one method `WithHost` in `namespace Grpc.Core` . Also, this is in C# and might be needed in other languages too.

I know the `GrpcChannel` type has it like `channel.Target` in the below snippet to get that information.

```
var channel = GrpcChannel.ForAddress("http://localhost:1357");

var appCli = new App.AppClient(channel);
```

I need something like `appCli.Target` or similar to get that info.

PS - During debugging I could get that info from `(Grpc.Net.Client.Internal.HttpClientCallInvoker) appCli.Configuration.undecoratedCallInvoker`, however I could not use it in code as `HttpClientCallInvoker` is `internal` or `Configuration` method was not accessible.

The reason why I am asking is, say if I connect to n servers, then I need to maintain a key value for each client connection. With this feature or enhancement, I might not need to.

Apologies if this question is already answered!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.