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:
Derek Hulley
2006-07-26 10:49:21 +00:00
parent 36f219edf1
commit 595556f3c5
39 changed files with 1924 additions and 1602 deletions

View File

@@ -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