gRPC python socket_mutator

97 views
Skip to first unread message

Rodrigo Alexandre

unread,
Jan 10, 2023, 7:06:04 PM1/10/23
to grpc.io
Hello everyone,

I am trying to make a gRPC client to use a specific exit interface.
For that, I am setting the value for the "socket_mutator" in the channel_arguments.
I defined a function that takes a socket as an argument and modifies it however I receive a:
TypeError: Expected int, bytes, or behavior, got <class 'function'>

Does someone know what should I place in the socket_mutator value instead?

Thank you for your time.

Richard Belleville

unread,
Jan 13, 2023, 6:33:24 PM1/13/23
to grpc.io
You're going very far off road here, but you'd need to write a C extension that instantiates a instance of grpc_socket_mutator that implements the functionality that you want, then put the pointer into a Python int object and pass it as the value in the channel arg.

Rodrigo Alexandre

unread,
Jan 16, 2023, 11:42:12 AM1/16/23
to grpc.io
I have tried that but I was not able to figure out how to make it work. Do you have any code examples of something like that being done?

Richard Belleville

unread,
Jan 19, 2023, 2:34:58 PM1/19/23
to grpc.io
As I said, you're going very far off-road here. I don't think anyone has ever tried this before.
Reply all
Reply to author
Forward
0 new messages