public class HostnameUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getNetworkHostname()
Gets the name which is likely to be the local host's primary
name on the network.
|
public static String getNetworkHostname() throws NativeException
IMPLEMENTATION:
gethostname()
function from the standard C Library. gethostname()
function from Ws2_32
library.
(without domain name). Note that this Windows function will do a
name service lookup and the method is therefore potentially blocking,
although it is more than likely that Windows has cached this result
on computer startup in its DNS Client Cache and therefore the
result will be returned very fast.NativeException
- if there was an error executing the
system call.