#include <cat/cat.h>
int catsock_run(int timeout, int lifespan);
If timeout is positive, the function will return when there have been only listening sessions, with no new connections, for timeout seconds. If timeout is <= 0, timeout is disabled.
The lifespan argument, if positive, is the number of seconds of total running time after which catsock_run() should close all listening sessions and return, as soon as there will be only listening sessions left.
If lifespan is less than 0, the lifespan functionality is disabled and sessions can listen indefinitely.
The function returns CAT_OK if successful, or a negative code otherwise.