![]() -> Click here to learn how to get live help <- |
GETSERVENTIndexNAMEgetservent, getservbyname, getservbyport, setservent, endservent - get service entrySYNOPSIS#include <netdb.h> struct servent *getservent(void); struct servent *getservbyname(const char *name, const char *proto); struct servent *getservbyport(int port, const char *proto); void setservent(int stayopen); void endservent(void); DESCRIPTIONThe fBgetservent()fP function reads the next line from the file fI/etc/servicesfP and returns a structure fIserventfP containing the broken out fields from the line. The fI/etc/servicesfP file is opened if necessary.The fBgetservbyname()fP function returns a fIserventfP structure for the line from fI/etc/servicesfP that matches the service fInamefP using protocol fIprotofP. If fIprotofP is NULL, any protocol will be matched. The fBgetservbyport()fP function returns a fIserventfP structure for the line that matches the port fIportfP given in network byte order using protocol fIprotofP. If fIprotofP is NULL, any protocol will be matched. The fBsetservent()fP function opens and rewinds the fI/etc/servicesfP file. If fIstayopenfP is true (1), then the file will not be closed between calls to fBgetservbyname()fP and fBgetservbyport()fP. The fBendservent()fP function closes fI/etc/servicesfP. The fIserventfP structure is defined in fI<netdb.h>fP as follows:
The members of the fIserventfP structure are:
RETURN VALUEThe fBgetservent()fP, fBgetservbyname()fP and fBgetservbyport()fP functions return the fIserventfP structure, or a NULL pointer if an error occurs or the end of the file is reached.FILES
CONFORMING TOBSD 4.3SEE ALSOgetprotoent(3), getnetent(3), services(5)
Index |