grpc-C# I want to specify the number of client-side local port.

33 views
Skip to first unread message

yuta

unread,
Oct 19, 2019, 10:24:39 PM10/19/19
to grpc.io
Hi.

I want to specify local port number of my grpc client (c#), something like : 

----------------------------------------------------------------------------------------------

var socketFactory = ?  // how to get socket factory struct from native c++ library from C#

var options = new List<ChannelOption>(){
new ChannelOption("grpc.socket_factory", pointer-to-socket-factory)
};

var channel = new Channel(hostname, portnum, new SslCredentials(cert_pem), options);

----------------------------------------------------------------------------------------------

The official api document says "channnel options listed in grpc_types.h file are available", and I want to access [Line:300] #define GRPC_ARG_SOCKET_FACTORY "grpc.socket_factory" option.

But I don't know how to access it from C# code. Could you give me a simple example code to specify local port?

thank you.

Jan Tattermusch

unread,
Oct 21, 2019, 2:29:35 AM10/21/19
to yuta, grpc.io
Hello,

this functionality is not supported in gRPC C#. More generally gRPC C# doesn't support specifying channel arguments (options) when they are custom native objects - this is mostly because it's hard to expose such concept in a safe and idiomatic way in C# library. Instead we only support channel options of type int and string.

--
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 grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/257224e1-b309-4ae1-a097-9f25133228f5%40googlegroups.com.


--

Jan

yuta

unread,
Oct 21, 2019, 3:42:15 AM10/21/19
to grpc.io
Thank you very much for your reply.

I get the point.
Reply all
Reply to author
Forward
0 new messages