AN_RECV(3)

NAME

an_recv - receive incoming data from a proxy-capable socket

SYNOPSIS

#include <antinat.h>

int an_recv(ANCONN s, void * buf, int length, int flags);

DESCRIPTION

The an_recv(3) function is used to fetch incoming data from a proxy-capable socket. The socket must be in the accepted or connected state. If the socket is in blocking mode, the an_recv(3) function will block until some data is successfully read from the socket. In non-blocking mode, if no data is available, the return value will be -1, and errno set to EAGAIN. To send data back to the originator of this data, use an_send(3).

s is a socket previously created with an_new_connection(3), and accepted or connected with an_accept(3), an_connect_tohostname(3) or an_connect_tosockaddr(3).

buf is a destination buffer to place the data in. It must contain at least as many bytes as specified in length, below.

length is the length of the user-supplied buffer, buf.

flags are flags, reserved for future use. Currently, there are no flags guaranteed to be supported across versions of this library. This parameter must be zero.

RETURN VALUE

The return value is the number of bytes read into buf, or -1 if an error occurs.

ERRORS

If an error occurs, the return value will be -1. errno will be set to provide more information about the cause of the error.

SEE ALSO

an_accept(3), an_connect_tohostname(3), an_connect_tosockaddr(3), an_new_connection(3), an_send(3)

AUTHOR

Malcolm Smith <malxau@users.sourceforge.net>