#include <cat/cat.h>
int catnet_listen(cat_session *lsess, const char *port);
If the port number is zero, the system will assign a random port. The true number used can be extracted using catnet_getnetinfo.
A listening session cannot be used for any other purpose. If any descriptors in lsess are in use, the catnet_listen function will return CAT_EBUSY.
If the function is successful, 0 is returned and cat_poll() or catsock_run() can be used to wait for pending connections.
On error, a negative error code is returned.