getservbyname()

Returns service information on the specified service name.

service = getservbyname(name, proto)

struct servent

*service;

char

*name, *proto;

service

Pointer to a servent structure that contains service

 

information returned by getservbyname().

 

The servent structure is defined in the include files

 

<netdb.h>, SOCKET.PASI, and SOCKET.FTNI, for C,

 

Pascal, and FORTRAN programs, respectively.

name

Pointer to string that contains the service name from which to

 

get information on the service. It can be either an official

 

service name or an alias. Terminate the string with the

 

character \0.

proto

Pointer to string that contains the name of the transport

 

protocol to use when contacting the service. Use •tcp" or 0 if

 

TCP is the only protocol for the service. (Remember to

 

terminate the string with the character \0.)

getservbyport()

Returns service information on the specified port number.

service = getservbyport(port, proto)

struct servent

*service;

int

port;

char

*proto;

service

Pointer to a servent structure that contains service

 

information returned by getservbyname().

 

The servent structure is defined in the include files

 

<netdb.h>, SOCKET.PASI, and SOCKET.FTNI, for C,

 

Pascal, and FORTRAN programs, respectively.

port

Port number from which to get information on the service.

proto

Pointer to string that contains the name of the transport

 

protocol to use when contacting the service. Use •tcp" or 0 if

 

TCP is the only protocol for the service. Terminate string with

 

character \0.

 

Set this value to NULL if you do not want to specify any specific

 

protocol.

Berkeley Software Distribution Interprocess Communication 427