COHERENT manpages

This page displays the COHERENT manpage for gethostbyname() [Retrieve a host IP address by name].

List of available manpages
Index


gethostbyname() -- Sockets Function (libsocket)

Retrieve a host IP address by name
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
struct hostent *gethostbyname(host)
char *host;

Function gethostbyname() interrogates file /etc/hosts for information about
a host  on a network.   host gives the  address where the name  of the host
resides in memory.

If it  could find the address of host,  gethostbyname() returns the address
in  a  instance of  structure  hostent,  which is  defined  in header  file
<netdb.h>. If  it could  not, or  if host points  to a  spurious host
name, it returns NULL.

See Also

endhostent(),
gethostbyaddr(),
libsocket,
sethostent()