gethostbyaddr

Returns information about a host, given its Internet address.

Library:LibC
Standard:BSD
Service:Networking

Syntax

  #include <netdb.h>    
   
  struct hostent *gethostbyaddr (
     const char  *addr,
     int          len,
     int          type);
  

Parameters

addr

(IN) Points to an in_addr structure containing the host’s Internet address. This address is in binary format (that is, not null terminated) and in network byte order.

len

(IN) Specifies the length of the Internet address, in bytes.

type

(IN) Specifies the value corresponding to the type of Internet address (always AF_INET).

Return Values

If successful, returns a pointer to a structure of type hostent. Otherwise, returns NULL and sets h_errno to the following:

Decimal

Constant

Description

1

HOST_NOT_FOUND

No such host is known.

Remarks

When the type is AF_INET, the gethostbyaddr function accepts a pointer to a in_addr structure containing the Internet address, an integer value representing the length, and an integer value representing the application family type. The numeric Internet address is expressed in network byte order; the Internet address length is expressed in bytes.

Calling any database routine overwrites the results of the last call to this function.

See Also

gethostbyname