Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hosts(5n)

ypserv(8)



GETHOSTENT(3N)          COMMAND REFERENCE          GETHOSTENT(3N)



NAME
     gethostent, gethostbyaddr, gethostbyname, sethostent,
     endhostent - get network host entry

SYNOPSIS
     #include <netdb.h>

     struct hostent *gethostent()

     struct hostent *gethostbyname(name)
     char *name;

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

     sethostent(stayopen)
     int stayopen;

     endhostent()

     sethostsock(stayopen)
     int stayopen;

     endhostsock()

     struct hostent *server_req()

DESCRIPTION
     The calls gethostent, gethostbyname, and gethostbyaddr each
     return a pointer to an object with the following structure:

          struct    hostent {
               char *h_name;  /* official name of host */
               char **h_aliases;   /* alias list */
               int  h_addrtype;    /* host address type */
               int  h_length; /* length of address */
               char *h_addr;  /* address */
          };

     The members of this structure are:

          h_name  Official name of the host.

          h_aliases
                  A zero terminated array of alternate names for
                  the host.

          h_addrtype
                  The type of address being returned; currently
                  always AF_INET.

          h_length



Printed 3/13/89                                                 1





GETHOSTENT(3N)          COMMAND REFERENCE          GETHOSTENT(3N)



                  The length, in bytes, of the address.

          h_addr  A pointer to the network address for the host.
                  Host addresses are returned in network byte
                  order.

     The gethostent call reads the next line of the file,
     /etc/hosts, opening the file if necessary; the file remains
     open upon completion.

     If the Yellow Pages aren't running both gethostbyname and
     gethostbyaddr open a UTek domain socket (/tmp/nameserver) to
     the nameserver(8n), if necessary, then make a request and
     get an answer.  The socket is closed upon completion.  Host
     addresses are supplied in network order.

     The call sethostent opens and rewinds the file; if the
     stayopen flag is nonzero, the host data base is not closed
     by subsequent calls to endhostent; the endhostent call
     closes the file.

     The call sethostsock opens the socket to the
     nameserver(8n);ifthe stayopen flag is nonzero the socket is
     not closed until endhostsock is called; endhostsock closes
     the socket.

FILES
     /etc/hosts
     /etc/yp/domainname/hosts.byname
     /etc/yp/domainname/hosts.byaddr

     The domainname is the name of your host (domain).

DIAGNOSTICS
     Null pointer (0) returned on end-of-file or error.

CAVEATS
     All information is contained in a static area so it must be
     copied if it is to be saved.  Only the Internet address
     format is currently understood.

SEE ALSO
     hosts(5n), ypserv(8).












Printed 3/13/89                                                 2



%%index%%
na:408,146;
sy:554,3120;
de:3674,1322;5476,2323;
fi:7799,343;
di:8142,179;
ca:8321,242;
se:8563,143;
%%index%%000000000134

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