Getservent – Comtrol eCos User Manual

Page 531

Advertising
background image

Chapter 38. TCP/IP Library Reference

BSD

Oct 18, 2000

BSD

getservent

GETSERVENT(3)

System Library Functions Manual

GETSERVENT(3)

NAME

getservent, getservbyport, getservbyname, setservent, endservent - get

service entry

SYNOPSIS

#include

<

netdb.h>

struct servent *

getservent(void);

struct servent *

getservbyname(char *name, char *proto);

struct servent *

getservbyport(int port, char *proto);

void

setservent(int stayopen);

void

endservent(void);

DESCRIPTION

The getservent(), getservbyname(), and getservbyport() functions each

return a pointer to an object with the following structure containing the

broken-out fields of a line in the network services database,

/etc/services.

struct

servent {

char

*s_name;

/* official name of service */

char

**s_aliases;

/* alias list */

int

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.

427

Advertising