| getInterfaceAddress |
(String name [, int version]) |
yoix.net |
| |
Returns a
String
that is the IP address of the network interface named
name
(e.g.,
eth0)
or
NULL
if there is no such interface.
The optional
version
argument should be
IPV4
or
IPV6,
which are defined in
yoix.net,
and is used to restrict the answer to an Internet Protocol Version 4
or Internet Protocol Version 6 address.
Omitting
version
means
getInterfaceAddress
looks for an
IPV4
address, followed by an
IPV6
address, and only returns
NULL
when neither exist.
| |
| Example: |
The program,
import yoix.*.*;
printf("IPV4=%s\n", getInterfaceAddress("lo", IPV4));
printf("IPV6=%s\n", getInterfaceAddress("lo", IPV6));
should print
IPV4=127.0.0.1
IPV6=0:0:0:0:0:0:0:1
on standard output, which you may recognize loopback addresses.
| | |
| Return: |
String
| | |
| See Also: |
getAddress,
getAllByName,
getHostAddress,
getHostName,
getInterfaceAddresses,
isAnyLocalAddress,
isLinkLocalAddress,
isLoopbackAddress,
isMCGlobal,
isMCLinkLocal,
isMCNodeLocal,
isMCOrgLocal,
isMCSiteLocal,
isMulticastAddress,
isReachable,
isSiteLocalAddress
|
|
Yoix is a registered trademark of AT&T Inc.
|