Gets network host entry by address.
Standard C Library (libc.a)
(libbind)
(libnis)
(liblocal)#include <netdb.h>
int gethostbyadd_r(Addr, Len, Type, Htent, Ht_data)
const char *Addr, size_t Len, int Type, struct hostent *Htent, struct hostent_data *Ht_data;This function internally calls the gethostbyaddr subroutine and stores the value returned by the gethostbyaddr subroutine to the hostent structure.
| Item | Description | 
|---|---|
| Addr | Points to the host address that is a pointer to the binary format address. | 
| Len | Specifies the length of the address. | 
| Type | Specifies the domain type of the host address. It can be either AF_INET or AF_INET6. | 
| Htent | Points to a hostent structure which is used to store the return value of the gethostaddr subroutine. | 
| Ht_data | Points to a hostent_data structure. | 
The function returns a 0 if successful and a -1 if unsuccessful.
If the Name parameter is a hostname, this subroutine searches for a machine with that name as an IP address. Because of this, use the gethostbyname_r subroutine.
| Item | Description | 
|---|---|
| HOST_NOT_FOUND | The host specified by the Name parameter was not found. | 
| TRY_AGAIN | The local server did not receive a response from an authoritative server. Try again later. | 
| NO_RECOVERY | Indicates an unrecoverable error occured. | 
| NO_ADDRESS | The requested Name parameter is valid but does not have an Internet address at the name server. | 
| SERVICE_UNAVAILABLE | None of the name services specified are running or available. | 
| EINVAL | The hostent pointer is NULL | 
| Item | Description | 
|---|---|
| /etc/hosts | Contains the host name data base. | 
| /etc/resolv.conf | Contains the name server and domain name. | 
| /etc/netsvc.conf | Contains the name services ordering. | 
| /usr/include/netdb.h | Contains the network database structure. |