VMS Help  —  TCPIP Services, Programming Interfaces, Socket API Functions, getservent()
    Retrieves an entry from the services database file.
    Format
      #include  <netdb.h>
      struct servent *getservent  (void);

1  –  Description

    This function reads the next line of the services database file
    (TCPIP$ETC:SERVICES.DAT).
    An application program can use the getservent() function to
    retrieve information about a service (such as the protocol or
    the ports it uses) from the services database.
    The getservent() function returns a servent structure that
    contains information from the services database file. See servent
    Structure for a description of the servent structure. The servent
    structure is defined in the NETDB.H header file.
    The ASCII text services database file remains open after a call
    by the getservent() function. Use the endservent()  function to
    close the services database file. Use the setservent() function
    to open the services database file and reset the file marker to
    the beginning of the file.
    The getservent function uses a common static area for its return
    values, so subsequent calls to this function overwrite any
    existing service entry. To save the services entry, you must
    make a copy of it.
    Related Functions
    See also setservent and endservent.

2  –  Return Values

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