Although you can use grpc_socket_mutator to do this, please note that it's not actually a public API, so we don't guarantee that the API won't change without notice between versions of gRPC.
The internal API is at https://github.com/grpc/grpc/blob/master/src/core/lib/iomgr/socket_mutator.h . On Thursday, August 13, 2020 at 6:37:12 AM UTC-7 [email protected] wrote: > > I am facing a similar issue on my grpc python client and server, I need to > use SO_BINDTODEVICE option, and I cannot find any examples or how I can > implement it using grpc socket mutator option.. could you help with an > example on how such an implementation would look like as the documentations > just suggests that grpc socket mutator is a pointer. > > > On Tuesday, July 23, 2019 at 5:47:15 AM UTC+5:30, Yash Tibrewal wrote: >> >> >> https://github.com/grpc/grpc/blob/0beb353f0a21024659bedfb3e816a4f99eff41e8/include/grpcpp/support/channel_arguments_impl.h#L84 >> >> is what you want >> >> On Monday, July 8, 2019 at 12:11:34 PM UTC-7, Lalit Kumar wrote: >>> >>> My grpc++ server is crashing while binding to ip address. IP address is >>> valid and present on system. However interface to which it is bounded >>> belongs to different VRF. >>> >>> Is there any API which can be used to set the socket option( >>> SO_BINDTODEVICE) ? >>> >>> root@SeastoneXP-5:~/lalit# ./gnmi_server.bin >>> SetupServer address 10.9.5.14 >>> E0708 19:08:02.766255725 27546 server_chttp2.cc:40] >>> {"created":"@1562612882.766193175","description":"No address added out of >>> total 1 >>> resolved","file":"src/core/ext/transport/chttp2/server/chttp2_server.cc","file_line":348,"referenced_errors":[{"created":"@1562612882.766187475","description":"Unable >>> >>> to configure >>> socket","fd":122,"file":"src/core/lib/iomgr/tcp_server_utils_posix_common.cc","file_line":217,"referenced_errors":[{"created":"@1562612882.766170075","description":"Cannot >>> >>> assign requested >>> address","errno":99,"file":"src/core/lib/iomgr/tcp_server_utils_posix_common.cc","file_line":190,"os_error":"Cannot >>> >>> assign requested address","syscall":"bind"}]}]} >>> Server listening on 10.9.5.14 Port 50042 >>> Segmentation fault >>> root@SeastoneXP-5:~/lalit# ifconfig ma1 >>> ma1 Link encap:Ethernet HWaddr 00:e0:ec:7a:83:12 >>> inet addr:10.9.5.14 Bcast:10.9.255.255 Mask:255.255.0.0 >>> inet6 addr: fe80::2e0:ecff:fe7a:8312/64 Scope:Link >>> inet6 addr: 2600:1700:470:6f3f:10:9:101:53e/64 Scope:Global >>> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 >>> RX packets:958942 errors:0 dropped:7 overruns:19 frame:0 >>> TX packets:111757 errors:0 dropped:0 overruns:0 carrier:0 >>> collisions:0 txqueuelen:1000 >>> RX bytes:214464622 (204.5 MiB) TX bytes:15174663 (14.4 MiB) >>> Memory:dff40000-dff5ffff >>> >>> root@SeastoneXP-5:~/lalit# ip link show ma1 >>> 4: ma1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master >>> management state UP mode DEFAULT group default qlen 1000 >>> link/ether 00:e0:ec:7a:83:12 brd ff:ff:ff:ff:ff:ff >>> root@SeastoneXP-5:~/lalit# >>> >>> >>> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/930226a6-27f9-4d0b-9a69-3666228288fen%40googlegroups.com.
