Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
getservbyname(3)
Edit
PageHistory
Diff
Info
LikePages
GETSERVENT !!!GETSERVENT NAME SYNOPSIS DESCRIPTION RETURN VALUE FILES CONFORMING TO SEE ALSO ---- !!NAME getservent, getservbyname, getservbyport, setservent, endservent - get service entry !!SYNOPSIS __#include __''name''__, const char *__''proto''__); struct servent *getservbyport(int__ ''port''__, const char *__''proto''__); void setservent(int__ ''stayopen''__); void endservent(void); __ !!DESCRIPTION The __getservent()__ function reads the next line from the file ''/etc/services'' and returns a structure ''servent'' containing the broken out fields from the line. The ''/etc/services'' file is opened if necessary. The __getservbyname()__ function returns a ''servent'' structure for the line from ''/etc/services'' that matches the service ''name'' using protocol ''proto''. If ''proto'' is NULL, any protocol will be matched. The __getservbyport()__ function returns a ''servent'' structure for the line that matches the port ''port'' given in network byte order using protocol ''proto''. If ''proto'' is NULL, any protocol will be matched. The __setservent()__ function opens and rewinds the ''/etc/services'' file. If ''stayopen'' is true (1), then the file will not be closed between calls to __getservbyname()__ and __getservbyport()__. The __endservent()__ function closes ''/etc/services''. The ''servent'' structure is defined in '''' as follows: struct servent { char *s_name; /* official service name */ char **s_aliases; /* alias list */ int s_port; /* port number */ char *s_proto; /* protocol to use */ } The members of the ''servent'' structure are: ''s_name'' The official name of the service. ''s_aliases'' A zero terminated list of alternative names for the service. ''s_port'' The port number for the service given in network byte order. ''s_proto'' The name of the protocol to use with this service. !!RETURN VALUE The __getservent()__, __getservbyname()__ and __getservbyport()__ functions return the ''servent'' structure, or a NULL pointer if an error occurs or the end of the file is reached. !!FILES ''/etc/services'' services database file !!CONFORMING TO BSD 4.3 !!SEE ALSO getprotoent(3), getnetent(3), services(5) ----
8 pages link to
getservbyname(3)
:
Man3g
services(5)
freeaddrinfo(3)
gai_strerror(3)
getaddrinfo(3)
getnameinfo(3)
named-xfer(8)
named(8)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.