| getAllByName |
([String host[, int bytes]]) |
yoix.net |
| getAllByName |
(int bytes) |
|
| |
Returns an array of strings that list all IP addresses associated with
host,
which should be a name that can be resolved by DNS or an IP address,
or the local host if no argument is given.
If
bytes
is supplied and is non-zero, then an array of arrays is returned where each sub-array
is an array of integers in network byte order, so the highest order byte of the
address is in the first element of the sub-array.
The result will be
NULL
if the host cannot be found.
| |
| Example: |
The program,
import yoix.net.*;
import yoix.stdio.*;
Array addrs;
int n;
if ((addrs = getAllByName()) != NULL) {
printf("All addresses:\n");
for (n = 0; n < addrs@sizeof; n++)
printf(" %s\n", addrs[n]);
}
prints all the IP addresses of your local host.
There is an even easier way to get the information if you are not
fussy about what the output looks like.
The program,
import yoix.net.*;
import yoix.stdio.*;
printf("All addresses: %O\n", getAllByName());
uses
%O
in the
printf
format string to dump the contents of the array returned by
getAllByName.
| | |
| Return: |
Array
| | |
| See Also: |
getAddress,
getHostAddress,
getHostName,
getInterfaceAddress,
getInterfaceAddresses,
isAnyLocalAddress,
isLinkLocalAddress,
isLoopbackAddress,
isMCGlobal,
isMCLinkLocal,
isMCNodeLocal,
isMCOrgLocal,
isMCSiteLocal,
isMulticastAddress,
isReachable,
isSiteLocalAddress
|
|
Yoix is a registered trademark of AT&T Inc.
|