Manual Page Result
0
Command: gethostbyaddr | Section: 3 | Source: Digital UNIX | File: gethostbyaddr.3.gz
gethostbyaddr(3) Library Functions Manual gethostbyaddr(3)
NAME
gethostbyaddr, gethostbyaddr_r - Gets a network host entry by address
LIBRARY
Standard C Library (libc.so, libc.a)
SYNOPSIS
#include <netdb.h>
struct hostent *gethostbyaddr( const void *addr, size_t len,
int type) ;
[Digital] The following obsolete function is supported in order to
maintain backward compatibility with previous versions of the operating
system. You should not use it in new designs. int *gethostbyaddr_r(
const char *addr, int len, int type, struct hostent
*hptr, struct hostent_data *hdptr);
[Digital] The following definition of the gethostbyaddr() function
does not conform to current standards and is supported only for back-
ward compatibility (see standards(5)): struct hostent *gethostbyaddr(
const char *addr, int len, int type) ;
STANDARDS
Interfaces documented on this reference page conform to industry stan-
dards as follows:
gethostbyaddr(): XPG4-UNIX
Refer to the standards(5) reference page for more information about in-
dustry standards and associated tags.
PARAMETERS
Specifies an Internet address in network order. Specifies the number
of bytes in an Internet address. Specifies the Internet domain address
format. The value AF_INET must be used. [Digital] Is data for the
host database. The netdb.h header file defines the hostent_data struc-
ture. [Digital] Points to the hostent structure. The netdb.h header
file defines the hostent structure.
DESCRIPTION
The gethostbyname() function returns a pointer to a structure of type
hostent. Its members specify data obtained from either the local
/etc/hosts file or one of the files distributed by BIND or NIS. To de-
termine which file or files to search, and in which order, the system
uses the switches in the /etc/svc.conf file. The netdb.h header file
defines the hostent structure.
The gethostbyaddr() function searches the network host database sequen-
tially until a match with the addr and type parameters occurs. The len
parameter must specify the number of bytes in an Internet address. The
address parameter must specify the address in network order. The type
parameter must be the constant AF_INET, which specifies the Internet
address format. When EOF (End-of-File) is reached without a match, an
error value is returned.
If using BIND, the information is obtained from a name server specified
in the /etc/resolv.conf file. When the name server is not running, the
gethostbyaddr() function searches the local hosts name file.
Use the endhostent() function to close the /etc/hosts file.
NOTES
The gethostbyaddr() function returns a pointer to thread-specific data.
Subsequent calls to this or a related function from the same thread
overwrite this data.
[Digital] The gethostbyaddr_r() function is an obsolete reentrant ver-
sion of the gethostbyaddr() function. It is supported in order to
maintain backward compatibility with previous versions of the operating
system and should not be used in new designs. Note that you must zero-
fill the hdptr structure before its first access by the gethost-
byaddr_r() function.
RETURN VALUES
Upon successful completion, the gethostbyaddr() function returns a
pointer to a hostent structure. If it reaches the end of the network
hostname database, it returns a null pointer.
[Digital] Upon successful completion, the gethostbyaddr_r() function
stores the hostent structure in hptr, and returns a value of 0 (zero).
Upon failure, it returns a value of -1.
ERRORS
If the gethostbyaddr() or gethostbyaddr_r() function call fails, h_er-
rno is set to one of the following values: Host is unknown. No address
is available for the name specified in the server request. This is not
a soft error. Another type of name server request may be successful.
An unexpected server failure occurred. This is a nonrecoverable error.
This is a soft error that indicates that the local server did not re-
ceive a response from an authoritative server. A retry at some later
time may be successful.
[Digital] If any of the following conditions occurs, the gethost-
byaddr_r() function sets errno to the corresponding value: The name,
hptr, or hdptr is invalid, or type is not AF_INET.
FILES
This file is the DARPA Internet network hostname database. Each record
in the file occupies a single line and has three fields consisting of
the host address, official hostname, and aliases. The resolver config-
uration file. The database service selection configuration file.
RELATED INFORMATION
Functions: endhostent(3), gethostbyname(3), sethostent(3).
Files: hosts(4), resolv.conf(4), svc.conf(4).
Networks: bind_intro(7), nis_intro(7).
Standards: standards(5) delim off
gethostbyaddr(3)