NAME

catsock_run - run sessions

SYNOPSIS

#include <cat/cat.h>

int catsock_run(int timeout, int lifespan);

DESCRIPTION

This function handles the sessions defined by catsock_add() or just waits for them to finish, depending on the platform. The function returns when there are no sessions left to serve.

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.

SEE ALSO

cat, catnet, catsock_add