NAME

catnet_servbyport - network database function, retrieve service by port

SYNOPSIS

#include <cat/catutil.h>

catnet_serv *catnet_servbyport(in port, const char *proto);

DESCRIPTION

A thread safe wrapper function for retrieving the service via the service port number an the protocol proto. The call returns a pointer to a catnet serv struct that looks like this.

  typedef struct catnet_serv {
      char **names;               /* name, alias, ..., NULL */
      int port;                   /* port number */
  } catnet_serv;

The names parameter will contain the name of the service and any aliases. Port will contain the port number for the service.

The returned pointer points to dynamically allocated memory that needs to be free by the caller with a call to free().

NOTES

This function is thread-safe, but is otherwise a wrapper around the standard call getservbyport or getservbyport_r.

SEE ALSO

cat, catutil

catnet_servbyname