getservbyname()

The getservbyname() call returns a pointer to the ETC\SERVICES file entry specified by a service name.

Syntax

#include <netdb.h>
struct servent *getservbyname(name, proto)
char *name;
char *proto;

Parameters

name

proto

Description

This call searches the ETC\SERVICES file for the specified service name, which must match the protocol if a protocol is stated.

The getservbyname() call retrieves an entry from the ETC\SERVICES file using the name parameter as a search key.

An application program can use this call to access a service, service aliases, the protocol for the service, and a protocol port number for the service.

The getservbyname() call searches the ETC\SERVICES file sequentially from the start of the file until it finds one of the following: