Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issue 130 by fixing UDP transport initialization to properly bind to all network interfaces. The changes modify socket address creation to explicitly use "0.0.0.0" instead of relying on default behavior, and adds proper exception handling for hostname resolution failures.
- Explicitly binds UDP transport to all interfaces using "0.0.0.0"
- Adds exception handling for UnknownHostException during network initialization
- Updates both listen and search transport socket creation for consistency
| try { | ||
| // where to bind (listen) address | ||
| InetSocketAddress listenLocalAddress = new InetSocketAddress(broadcastPort); | ||
| InetSocketAddress listenLocalAddress = new InetSocketAddress(InetAddress.getByName("0.0.0.0"), broadcastPort); |
There was a problem hiding this comment.
The hardcoded IP address "0.0.0.0" should be extracted to a named constant to improve maintainability and make the intent clearer.
|
|
||
| searchTransport = (BlockingUDPTransport) searchConnector.connect(null, new ClientResponseHandler(this), | ||
| new InetSocketAddress(0), PVAConstants.PVA_PROTOCOL_REVISION, PVAConstants.PVA_DEFAULT_PRIORITY); | ||
| new InetSocketAddress(InetAddress.getByName("0.0.0.0"), 0), PVAConstants.PVA_PROTOCOL_REVISION, PVAConstants.PVA_DEFAULT_PRIORITY); |
There was a problem hiding this comment.
The hardcoded IP address "0.0.0.0" should be extracted to a named constant to avoid duplication and improve maintainability.
Contributor
|
Did the following suggestion work? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have submitted this fix for the issue 130 I raised nearly a year ago. Hopefully it can be merged into the master