#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);Struktura servent wygląda tak:
struct servent {
char *s_name; /* nazwa usługi */
char **s_aliases; /* nazwy alternatywne */
int s_port; /* numer portu */
char *s_proto; /* protokół transportowy */
}