AN_BIND_TOHOSTNAME
Section: Antinat Programmer's Manual (3)Updated: 2004-09-28
Index Return to Main Contents
NAME
an_bind_tohostname - bind to an incoming address
SYNOPSIS
#include <antinat.h>
int an_bind_tohostname(ANCONN s, const char *hostname, unsigned short port);
DESCRIPTION
The an_bind_tohostname(3) function is used allow incoming connections from the specified hostname. 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.
hostname is a hostname that a connection will be allowed from.
port is the port that a connection will be allowed from. The antinat server ignores this value.
NOTES
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.
RETURN VALUE
This call returns AN_ERROR_SUCCESS to indicate successful completion.
ERRORS
- AN_ERROR_INVALIDARG
- The socket handle or hostname is invalid.
- AN_ERROR_NAMERESOLVE
- Could not resolve the proxy hostname. For some types of proxy, the remote client name will also need to be locally resolved, and could also generate this error.
- AN_ERROR_NOTSUPPORTED
- This call cannot be made on the type of socket, or cannot return socket information for this type of connection.
- AN_ERROR_ORDER
- This call must be called without having performed any operation on the socket other than an_new_connection(3).
- AN_ERROR_NETWORK
- Could not read information from the network; a network error occurred.
- AN_ERROR_PROXY
- The proxy failed to successfully process the incoming connection.
SEE ALSO
an_accept(3), an_bind_tosockaddr(3), an_listen(3), an_new_connection(3)
AUTHOR
Malcolm Smith <malxau@users.sourceforge.net>
Index
Time: 14:19:43 GMT, January 09, 2005