Searches the host database sequentially from the beginning of the database for a host record with a given address.
#include <netdb.h> struct hostent *gethostbyaddr (char *addr, int len, int type);Routine Variants This socket routine has a variant named __bsd44_gethostbyaddr. Enabled by defining _SOCKADDR_LEN, this variant implements 4.4BSD-compatible semantics. See Section A.7 for more information.
The gethostbyaddr routine uses a common static area for its return values. This means that subsequent calls this routine will overwrite any existing host entry. You must make a copy of the host entry if you wish to save it.
NULL | Indicates an error. |
x | A pointer to an object having the
hostent structure. See <netdb.h> for a description of the hostent
structure.
Depending on the error condition and the socket implementation selected, errno or h_errno might be set to further indicate the error. (See sections A.5 and A.6.) |