NAME

cat_recv - read data from a file descriptor

SYNOPSIS

#include <cat.h>

int cat_recv(cat_session *session, int fd_id, cat_buffer **bufferp);

DESCRIPTION

Reads any data available from the descriptor fd_id, filters it through all applicable filters, and returns it in the bufferp argument. If the data is not given as an argument to a write descriptor, the data must eventually be freed.

The fd_id must be one of CAT_CLIENT_RFD or CAT_SERVER_RFD.

If used from within a filter, only the filters below will be invoked.

RETURN VALUES

Returns the total amount of data received, or a negative value on error. Note that zero is a valid return value. When the descriptor has been closed, cat_recv() will return CAT_EOF. The CAT_EAGAIN error code indicates that reading may succeed at a later time, as indicated by a call to cat_poll().

SEE ALSO

cat, cat_send, cat_poll