Skip to content

Is it possible to access the underlying socket when using ManagedChannelBuilder? #11960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GiantSox opened this issue Mar 12, 2025 · 2 comments
Labels

Comments

@GiantSox
Copy link

Hi there!

I'm working with an environment where I have a gRPC client on Android that needs to connect to a server running on a specific network. In order to access that network, I need to bind the socket I want to communicate over to the Network object using Network.bindSocket() before the socket connects.

Is it possible to access the socket somehow so I can do that?

@kannanjgithub
Copy link
Contributor

No, the socket created is not exposed for you to do that.

@ejona86
Copy link
Member

ejona86 commented Mar 31, 2025

You can't access the socket gRPC creates, but you can create the socket for gRPC to use by providing a socketFactory. That allows you to bind to a particular network. Your SocketFactory can delegate to SocketFactory.getDefault().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants