AN_CONNECT_TOHOSTNAME
Section: Antinat Programmer's Manual (3)
Updated: 2005-02-25
Index
Return to Main Contents
NAME
an_connect_tohostname - connect to an outgoing address
SYNOPSIS
#include <antinat.h>
int an_connect_tohostname(ANCONN s, const char *hostname, unsigned short port);
DESCRIPTION
The
an_connect_tohostname(3)
function is used to connect to the specified hostname at the specified port.
This call should be used in preference to
an_connect_tosockaddr(3)
because it allows name resolution to be deferred to the proxy where possible.
s
is a socket previously created with
an_new_connection(3)
call.
hostname
is a hostname that a connection will be initiated to.
port
is the port that a connection will be initiated to. This can be specified in
host byte-order.
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_AUTH
-
The proxy would not accept the authentication credentials that were
supplied to it.
- AN_ERROR_INVALIDARG
-
The socket handle or hostname is invalid.
- AN_ERROR_NAMERESOLVE
-
Could not resolve proxy hostname; for some types of proxy, the remote host
also needs to be locally resolved, which could also generate this error.
- AN_ERROR_NOMEM
-
Could not allocate memory to translate hostname into address where the client
will connect directly.
- 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 connection.
CONFORMING TO
This function appeared in Antinat 0.70.
SEE ALSO
an_close(3),
an_connect_tosockaddr(3)
an_new_connection(3)
AUTHOR
Malcolm Smith <malxau@users.sourceforge.net>
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- NOTES
-
- RETURN VALUE
-
- ERRORS
-
- CONFORMING TO
-
- SEE ALSO
-
- AUTHOR
-
Time: 03:29:47 GMT, May 22, 2005