-
Bug
-
Resolution: Fixed
-
P4
-
6-pool
-
b34
-
generic
-
generic
-
Not verified
The following url:
http://download.oracle.com/javase/tutorial/networking/nifs/definition.html
Stipulates that you can easily use the “NetworkInterface” class in the following manner:
NetworkInterface nif = NetworkInterface.getByName("bge0");
Enumeration nifAddresses = nif.getInetAddresses();
Socket soc = new java.net.Socket ();
soc.bind (nifAddresses.nextElement ());
soc.connect (new InetSocketAddress (address, port));
The bind method does not, as yet, accept “InetAddress” as a parameter. The correct code thus, is still:
soc.bind ((SocketAddress) new InetSocketAddress (nifAddresses.nextElement (), 0));
Also, in light of stricter rules, I think the following line be replaced,
Enumeration nifAddresses = nif.getInetAddresses();
with:
Enumeration <InetAddress> nifAddresses = nif.getInetAddresses ();
http://download.oracle.com/javase/tutorial/networking/nifs/definition.html
Stipulates that you can easily use the “NetworkInterface” class in the following manner:
NetworkInterface nif = NetworkInterface.getByName("bge0");
Enumeration nifAddresses = nif.getInetAddresses();
Socket soc = new java.net.Socket ();
soc.bind (nifAddresses.nextElement ());
soc.connect (new InetSocketAddress (address, port));
The bind method does not, as yet, accept “InetAddress” as a parameter. The correct code thus, is still:
soc.bind ((SocketAddress) new InetSocketAddress (nifAddresses.nextElement (), 0));
Also, in light of stricter rules, I think the following line be replaced,
Enumeration nifAddresses = nif.getInetAddresses();
with:
Enumeration <InetAddress> nifAddresses = nif.getInetAddresses ();