-
Feature Request
-
Resolution: Done
-
Minor
-
None
-
None
-
Low
Could you add a check in Util.getBindAddress() that checks the bind_addr against NetworkInterface.getByInetAddress() and throws some sort of exception if no NetworkInterface is returned?
I set my bind_addr via a database parameter and if the user mistakenly assigns the wrong bind address, it doesn't show up until UDP.createEphemeralDatagramSocket() when the localPort goes over 65535 because each attempt to create a DatagramSocket with the inet address that is not a local address throws a SocketException (actually a BindException) which is caught but ignored. When localPort finally goes over 65535 it throws an IllegalArgumentException.
So, a check in Util.getBindAddress() to see if the bind_addr is even available on the machine would lead to a failure in the configuration stage (setProperties).
As a side question, doesn't creating a DatagramSocket with port=0 guarantee an ephemeral port? Is it necessary to 'scan' for one? Perhaps a failure from the initial attempt with port=0 would wait a few ms and then try again with port=0?