net.csdn.common.network
Class NetworkUtils
java.lang.Object
net.csdn.common.network.NetworkUtils
public class NetworkUtils
- extends Object
BlogInfo: william
Date: 11-12-6
Time: 上午10:29
主要获取本机内网IP.避免需要手动在配置文件配置本机IP内网地址。
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IPv4_SETTING
public static final String IPv4_SETTING
- See Also:
- Constant Field Values
IPv6_SETTING
public static final String IPv6_SETTING
- See Also:
- Constant Field Values
NON_LOOPBACK_ADDRESS
public static final String NON_LOOPBACK_ADDRESS
- See Also:
- Constant Field Values
main
public static void main(String[] args)
local_address
public static InetAddress local_address()
intranet_ip
public static InetAddress intranet_ip()
isIPv4
public static boolean isIPv4()
getFirstNonLoopbackAddress
public static InetAddress getFirstNonLoopbackAddress(NetworkUtils.StackType ip_version)
getFirstNonLoopbackAddress
public static InetAddress getFirstNonLoopbackAddress(NetworkInterface intf,
NetworkUtils.StackType ipVersion)
throws SocketException
- Throws:
SocketException
getAllAvailableInterfaces
public static List<NetworkInterface> getAllAvailableInterfaces()
throws SocketException
- Throws:
SocketException
getAllAvailableAddresses
public static Collection<InetAddress> getAllAvailableAddresses()
Copyright © 2014. All Rights Reserved.