.TH gethostbyname() "" "" "Sockets Function (libsocket)"
.PC "Retrieve a host IP address by name"
.B "#include <netinet/in.h>"
.B "#include <arpa/inet.h>"
.B "#include <netdb.h>"
.B "#include <sys/socket.h>"
\fBstruct hostent *gethostbyname(\fIhost\^\fB)\fR
\fBchar *\fIhost\^\fB;\fR
.PP
Function
.B gethostbyname()
interrogates file
.B /etc/hosts
for information about a host on a network.
.I host
gives the address where the name of the host resides in memory.
.PP
If it could find the address of
.IR host ,
.B gethostbyname()
returns the address in a instance of structure
.BR hostent ,
which is defined in header file
.BR <netdb.h> .
If it could not, or if
.I host
points to a spurious host name, it returns
.BR NULL .
.SH "See Also"
.Xr "endhostent()," endhosten
.Xr "gethostbyaddr()," gethostba
.Xr "libsocket," libsocket
.Xr "sethostent()" sethosten
