VMS Help  —  TCPIP Services, Programming Interfaces, Socket API Functions, gethostbyname()
    Searches the hosts database that is referenced by the TCPIP$HOST
    logical name for a host record with the specified name or alias.
    If the host record is not found, this function may also invoke
    the BIND resolver to query the appropriate name server for the
    information.
    The $QIO equivalent is the IO$_ACPCONTROL function with the
    INETACP_FUNC$C_GETHOSTBYNAME subfunction code.
    Format
      #include  <netdb.h>
      struct hostent *gethostbyname  ( char *name );

1  –  Argument

 name
    A pointer to a null-terminated character string containing the
    name or an alias of the host being sought.

2  –  Description

    This function finds the first host with the specified name or
    alias in the hosts database, or using DNS/BIND.
    The gethostbyname() function uses a common static area for its
    return values. This means that subsequent calls to this function
    overwrite previously returned host entries. You must make a copy
    of the host entry if you want to save it.

3  –  Return Values

    x                  A pointer to an object having the hostent
                       structure.
    NULL               Indicates an error. errno is set to one of the
                       following values.

4  –  Errors

    ENETDOWN           TCP/IP Services was not started.
    HOST_NOT_FOUND     Host is unknown.
    NO_DATA            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.
    NO_RECOVERY        An unexpected server failure occurred. This is
                       a nonrecoverable error.
    TRY_AGAIN          A transient error occurred; for example,
                       the server did not respond. A retry may be
                       successful.
Close Help