Gets information on the specified service from the services
database that is referenced by the TCPIP$SERVICE logical name.
If not found there, this function may invoke the BIND resolver to
search TCPIP$ETC:SERVICES.DAT.
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 the services database until a matching
service name is found or the 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. For information
about the servent structure, refer to servent Structure.
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.