VMS Help
TCPIP Services, Programming Interfaces, Sockets API, getservbyname()

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    Gets information on the named service from the network services
    database.
    Format
      #include  <netdb.h>
      struct servent *getservbyname  ( char *name, char *proto );

  1 - Arguments

 name
    A pointer to a string containing the name of the service about
    which information is required.
 proto
    A pointer to a string containing the name of the protocol (TCP or
    UDP) for which to search.

  2 - Description

    This function searches sequentially from the beginning of the
    file until a matching service name is found, or until end of file
    is encountered. If a protocol name is also supplied, searches
    must also match the protocol.
    This function returns a pointer to a servent structure containing
    the data from the network services database:
    struct  servent {
            char    *s_name;        /* official name of service */
            char    **s_aliases;    /* alias list */
            long    s_port;         /* port service resides at */
            char    *s_proto;       /* protocol to use */
    };
    The members of this structure are:
    s_name             The official name of the service.
    s_aliases          A zero-terminated list of alternate names for
                       the service.
    s_port             The port number at which the service resides.
                       Port numbers are returned in network byte
                       order.
    s_proto            The name of the protocol to use when
                       contacting the service.
    All information is contained in a static area, so it must be
    copied to be saved.
    Related Functions
    See also getservbyport().

  3 - Return Values

    NULL               Indicates end of file or an error.
    x                  A pointer to a servent structure.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.