public class HostInfo extends Object
| Constructor and Description |
|---|
HostInfo() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAddress()
取得当前主机的地址
|
static InetAddress |
getLocalAddress()
取得当前主机信息
|
String |
getName()
取得当前主机的名称
|
String |
toString()
将当前主机的信息转换成字符串
|
public static InetAddress getLocalAddress() throws UnknownHostException
UnknownHostException - 异常public final String getName()
例如:"webserver1"
public final String getAddress()
例如:"192.168.0.1"
Copyright © 2019. All rights reserved.