*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> gethostbyname_r (3)              
Title
Content
Arch
Section
 

gethostbyname(3)

Contents


NAME    [Toc]    [Back]

       gethostbyname,  gethostbyname_r - Get a network host entry
       by name

SYNOPSIS    [Toc]    [Back]

       #include <netdb.h>

       struct hostent *gethostbyname(
               const char *name );

       [Tru64 UNIX]  The following function is supported in order
       to  maintain backward compatibility with previous versions
       of the operating system.  You should not  use  it  in  new
       designs.  int gethostbyname_r(
               const char *name,
               struct hostent *hptr,
               struct hostent_data *hdptr );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       gethostbyname():  XNS4.0, XNS5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies  the  official  network  name  or alias.  [Tru64
       UNIX]  For gethostbyname_r() only, this points to the hostent
  structure.   The netdb.h header file defines hostent
       structure.  [Tru64 UNIX]  For gethostbyname_r() only, this
       is  data  for  hosts  database.   The  netdb.h header file
       defines hostent_data structure.

DESCRIPTION    [Toc]    [Back]

       The gethostbyname() function returns a pointer to a structure
  of  type hostent.  Its members specify data obtained
       from either the local /etc/hosts file or one of the  files
       distributed by DNS/BIND or NIS. To determine which file or
       files to search, and in which order, the system  uses  the
       switches  in  the  /etc/svc.conf file.  The netdb.h header
       file defines the hostent structure.

       If using DNS/BIND, the information is obtained from a name
       server specified in the /etc/resolv.conf file.

       If  the  name parameter does not contain a dot "." and you
       are using DNS/BIND, the  gethostbyname()  function  checks
       whether  the  environment variable HOSTALIASES is set.  If
       set, it first searches the file named by  HOSTALIASES  for
       an  alias matching the name parameter.  The alias file has
       the following format:

       name1 name2

       The alias name.  This name cannot include dots.  The  host
       name  used  by  DNS/BIND  to look up the host information.
       The hosts database must be distributed by DNS/BIND.

NOTES    [Toc]    [Back]

       The gethostbyname() function returns a pointer to  threadspecific
 data. Subsequent calls to this or a related function
 from the same thread overwrite this data.

       [Tru64 UNIX]  The gethostbyname_r() function is  an  obsolete
  reentrant  version  of the gethostbyname() function.
       It is supported in order to maintain backward  compatibility
  with  previous  versions  of the operating system and
       should not be used in new designs.   Note  that  you  must
       zero-fill  the  hdptr structure before its first access by
       the gethostbyname_r() function.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, the  gethostbyname()  function
       returns  a  pointer to a hostent structure.  If it reaches
       the end of the network host name database,  it  returns  a
       null pointer.

       [Tru64  UNIX]  Upon  successful completion, the gethostbyname_r()
 function stores  the  hostent  structure  in  the
       location  pointed  to  by  hptr,  and returns a value of 0
       (zero). Upon failure, it returns a value of -1.

ERRORS    [Toc]    [Back]

       If the gethostbyname() or gethostbyname_r() function  call
       fails,  h_errno is set to one of the following the values:
       Host is unknown.  The server recognized  the  request  and
       the  name,  but  no  address  is  available  for the name.
       Another type of name server request may be successful.  An
       unexpected server failure occurred.  This is a nonrecoverable
 error.  A transient error occurred, for example,  the
       server did not respond.  A retry at some later time may be
       successful.

       [Tru64 UNIX]  If any of the following  conditions  occurs,
       the  gethostbyaddr_r()  function  sets errno to the corresponding
 value: The name, hptr, or hdptr is invalid.

FILES    [Toc]    [Back]

       The Internet network host name database.  Each  record  in
       the  file occupies a single line and has three fields consisting
 of the  host  address,  official  host  name,  and
       aliases.   The  resolver configuration file.  The database
       service selection configuration file.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: endhostent(3), gethostbyaddr(3), sethostent(3).

       Files: hostname(5), resolv.conf(4), svc.conf(4).

       Networks: bind_intro(7), nis_intro(7).

       Standards: standards(5)

       Network Programmer's Guide



                                                 gethostbyname(3)
[ Back ]
 Similar pages
Name OS Title
gethostbyname IRIX get network host entry
sethostent NetBSD get network host entry
gethostbyaddr NetBSD get network host entry
gethostent FreeBSD get network host entry
herror FreeBSD get network host entry
hstrerror FreeBSD get network host entry
gethostbyname Linux get network host entry
endhostent OpenBSD get network host entry
sethostent FreeBSD get network host entry
endhostent NetBSD get network host entry
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service