NAME

catnet_getnetinfo - get information for a socket

SYNOPSIS

#include <cat/cat.h>

int catnet_getnetinfo(cat_session *session, int fd_id, catnet_info *netinfo);

DESCRIPTION

This function retrieves information for the fd_id network socket that is associated with one of the logical descriptors in the I/O Handler of the session session.

If the call is successful, the netinfo structure will contain the following information.

  typedef struct catnet_info {
        CATSOCK fd;
        int my_port;
        int peer_port;
        char my_addr[16];
        char peer_addr[16];
  } catnet_info;

The fd will contain the value of the real socket. The my_addr and the peer_addr fields will contain the IP addresses of the connection endpoints. The my_port and the peer_port will contain the port numbers.

If either my_port or peer_port is negative, the corresponding address is undefined.

RETURN VALUES

The function returns 0 if successful and a negative value on failure.

SEE ALSO

cat, catnet