mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V1.3 to HEAD(3161:3179)
svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3161 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3179 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3406 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
@@ -1485,6 +1486,54 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
|
||||
&& addrs[i].getHostAddress().equals("0.0.0.0") == false)
|
||||
ipList.add(addrs[i].getAddress());
|
||||
}
|
||||
|
||||
// Check if the address list is empty, use the network interface list to get the local IP addresses
|
||||
|
||||
if ( ipList.size() == 0)
|
||||
{
|
||||
// Enumerate the network adapter list
|
||||
|
||||
Enumeration<NetworkInterface> niEnum = NetworkInterface.getNetworkInterfaces();
|
||||
|
||||
if ( niEnum != null)
|
||||
{
|
||||
while ( niEnum.hasMoreElements())
|
||||
{
|
||||
// Get the current network interface
|
||||
|
||||
NetworkInterface ni = niEnum.nextElement();
|
||||
|
||||
// Enumerate the addresses for the network adapter
|
||||
|
||||
Enumeration<InetAddress> niAddrs = ni.getInetAddresses();
|
||||
if ( niAddrs != null)
|
||||
{
|
||||
// Check for any valid addresses
|
||||
|
||||
while ( niAddrs.hasMoreElements())
|
||||
{
|
||||
InetAddress curAddr = niAddrs.nextElement();
|
||||
|
||||
if ( curAddr.getHostAddress().equals("127.0.0.1") == false &&
|
||||
curAddr.getHostAddress().equals("0.0.0.0") == false)
|
||||
ipList.add( curAddr.getAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( ipList.size() > 0 && logger.isDebugEnabled())
|
||||
logger.debug("Found " + ipList.size() + " addresses using interface list");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// DBEUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Found " + ipList.size() + " addresses using host name lookup");
|
||||
}
|
||||
|
||||
// Check if any addresses were added to the list
|
||||
|
||||
|
Reference in New Issue
Block a user