Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostbyaddr(3) — OSF/1 1.0 (TIN) MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gethostent(3)

gethostbyname(3)

endhostent(3)

gethostbyaddr(3)  —  Subroutines

OSF  —  Environment_Note_Added

NAME

gethostbyaddr − Gets network host entry by address

LIBRARY

Sockets Library (libc.a)

SYNOPSIS

#include <netdb.h>

struct hostent ∗gethostbyaddr (
char ∗addr,
int len,
int type) ;

PARAMETERS

addrSpecifies an Internet address in network order. 

lenSpecifies the number of bytes in an Internet address. 

typeSpecifies the Internet Domain address format. The value AF_INET must be used. 

DESCRIPTION

The gethostbyaddr() function searches the hosts network hostname file sequentially 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. 

The gethostbyaddr() function returns a pointer to a structure of type hostent. Its members specify data obtained from a name server specified in the /etc/resolv.conf file or from fields of a record line in the /etc/hosts network hostname database file.  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 subsequently called functions using the same structure. 

RETURN VALUES

Upon successful completion, a pointer to a hostent structure is returned.  A null pointer is returned whenever the end of the hosts network hostname file is reached. 

ERRORS

If the gethostbyaddr() function fails, h_errno may be set to one of the following values:

[TRY_AGAIN]
This is a soft error that indicates that the local server did not receive a response from an authoritative server. A retry at some later time may be successful.

[NO_RECOVERY]
This is a nonrecoverable error.

[NO_ADDRESS]
The address you used is not valid.  This is not a soft error, another type of name server request may be successful.

FILES

/etc/hostsThis 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 host name, and aliases. 

ENVIRONMENT NOTES

This section describes system features that are not generic to OSF/1 but that are provided in this OSF/1 implementation. 

Digital Extensions

The system searches either the local /etc/hosts file or one of the files distributed by BIND or NIS for the requested information.  To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. 
 

RELATED INFORMATION

Functions: gethostent(3), gethostbyname(3), endhostent(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026