an_bind_tosockaddr - bind to an incoming address
#include <antinat.h>
int an_bind_tosockaddr(ANCONN s, struct sockaddr *address, int length);
The an_bind_tosockaddr(3) function is used allow incoming connections from the specified address. In order to accept any incoming connection, an_listen(3) must be called on the bound socket. For proxy-based connections, only one incoming connection is allowed on any listening socket. Accepting a connection will use the primary socket for communication and will not create any other socket.
s is a socket previously created with an_new_connection(3) call.
address is a filled out sockaddr structure, containing an address family, address, and port that an incoming connection should be allowed from.
length is the length of the sockaddr structure, as determined by sizeof.
Although there is planned support for non-blocking sockets in a future release, this call should be considered a blocking call. A non-blocking socket will be silently (and temporarily) changed to a blocking one to process the connection.
This call returns AN_ERROR_SUCCESS to indicate successful completion.
This function appeared in Antinat 0.70.
an_accept(3), an_bind_tohostname(3), an_new_connection(3)
Malcolm Smith <malxau@users.sourceforge.net>