unsigned ctl_tcp_get_sockets(CTL_NET_PORT_t port, unsigned flags, CTL_SOCKET_t *sockets, unsigned max_socket_count);
ctl_tcp_get_sockets enumerates the sockets for the port port that match the conditions specified in flags. port is specified in network byte order. When a TCP server thread is woken up, before it can do anything useful it must first fetch a list of active sockets (on a per-port basis) using ctl_tcp_get_sockets.
flags is the bitwise-or of one or more of the flags in CTL_TCP_GET_SOCKETS_FLAG_t.
The sockets matching the combination of flags are written into the array pointed to by sockets which must have at least max_socket_count elements.
ctl_tcp_get_sockets returns the number of sockets that matched and were written into the sockets array.