getservbyport, getservbyname, getservent - network services database functions
#include <netdb.h> struct servent *getservbyname(const char *name, const char *proto); struct servent *getservbyport(int port, const char *proto); struct servent *getservent(void);
Refer to endservent().