Interface may be null if there are no suitable network interfaces.

This commit is contained in:
akwizgran
2012-11-13 13:46:43 +00:00
parent f69f6b3d43
commit eb4e7da354

View File

@@ -250,6 +250,7 @@ class LanTcpPlugin extends TcpPlugin {
ServerSocket ss = null; ServerSocket ss = null;
try { try {
InetAddress iface = chooseInterface(); InetAddress iface = chooseInterface();
if(iface == null) return null;
ss = new ServerSocket(); ss = new ServerSocket();
ss.bind(new InetSocketAddress(iface, 0)); ss.bind(new InetSocketAddress(iface, 0));
} catch(IOException e) { } catch(IOException e) {
@@ -261,6 +262,7 @@ class LanTcpPlugin extends TcpPlugin {
MulticastSocket ms = null; MulticastSocket ms = null;
try { try {
InetAddress iface = chooseInterface(); InetAddress iface = chooseInterface();
if(iface == null) return null;
ms = new MulticastSocket(); ms = new MulticastSocket();
ms.setInterface(iface); ms.setInterface(iface);
} catch(IOException e) { } catch(IOException e) {