public class NetworkUtilties
extends java.lang.Object
构造器和说明 |
---|
NetworkUtilties() |
限定符和类型 | 方法和说明 |
---|---|
static int[] |
findAvailableSocketPorts(int capacity)
找到可用端口号
|
static java.util.ArrayList<java.lang.String> |
getAllMac()
获取本机所有Mac地址,适用于多网卡机器
|
static java.lang.String |
getIpAddress()
获取本机ip地址
|
static java.lang.String |
getMacAddress()
获取本机mac地址
|
static boolean |
ping(java.lang.String hostName)
尝试是否能Ping通目标地址
|
public static boolean ping(java.lang.String hostName)
public static java.lang.String getIpAddress()
public static java.lang.String getMacAddress()
public static java.util.ArrayList<java.lang.String> getAllMac()
public static int[] findAvailableSocketPorts(int capacity)
capacity
- 需要的端口号数量