Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
gethostbyaddr(3) OSS Library Calls Reference Manual
NAME
gethostbyaddr - Gets a network host entry by address (AF_INET only)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <sys/socket.h>
#include <netdb.h>
extern h_errno;
struct hostent *gethostbyaddr (
const void *addr,
size_t len,
int type);
PARAMETERS
addr Specifies an Internet address in network-byte order.
len On input, specifies the number of bytes in addr. On output, specifies the number
of bytes in the retrieved address.
type Specifies the Internet domain address format. The value AF_INET must be
used.
DESCRIPTION
The gethostbyaddr( ) function searches host entries until a match with the addr and type parame-
ters is found.
The gethostbyaddr( ) function returns a pointer to a hostent struct whose members specify data
from a name server specified in the /etc/resolv.conf file or the /etc/hosts network hostname data-
base file. gethostbyaddr( ) first attempts to search /etc/resolv.conf, but when the name server is
not running, the gethostbyaddr( ) function searches the hosts name file. The hostent structure is
defined in the netdb.h header file.
Use the endhostent( ) function to close the /etc/hosts file.
NOTES
A return value points to static data, which is overwritten by any subsequent calls to gethost-
byaddr( ), gethostbyname( ), or gethostent( ).
RETURN VALUES
Upon successful completion of gethostbyaddr( ), a pointer to a hostent structure is returned if
the address was found, and a null pointer if the address was not found. If the call to gethost-
byaddr( ) fails, a null pointer is returned.
ERRORS
If the gethostbyaddr( ) function fails, h_errno might be set to one of the following values:
HOST_NOT_FOUND
The name is not a valid hostname or alias. This is not a soft error; another type of
name server request might be successful.
3−50 Hewlett-Packard Company 527187-017