Open System Services System Calls Reference Manual (G06.28+)
System Functions (s and S) spt_connectx(2)
• A timeout occurs
• A signal is caught
If timeout occurs, the spt_connectx() call fails and errno is set to [ETIMEDOUT]; the connec-
tion is aborted.
If an spt_connectx() call is interrupted by a signal that is caught while the call is blocked wait-
ing to establish a connection, the spt_connectx() call fails and sets errno to [EINTR]; the con-
nection is not aborted and is later established asynchronously.
When a connection cannot be created immediately and O_NONBLOCK is set for the file
descriptor of the socket, the spt_connectx() call fails and sets errno to [EINPROGRESS]; the
connection is not aborted and is later established asynchronously. Subsequent calls to the
spt_connectx() function for the same socket before the connection is completed will fail and set
errno to [EALREADY].
NOTES
The macro to map connect() to spt_connectx() is available in C applications when
SPT_THREAD_AWARE_NONBLOCK has been defined in the following manner before
including spthread.h:
#define SPT_THREAD_AWARE_NONBLOCK
The alias to link connect() to spt_connectx() is available in C++ applications when
SPT_THREAD_AWARE_PRAGMA_NONBLOCK has been defined in the following manner
before including spthread.h:
#define SPT_THREAD_AWARE_PRAGMA_NONBLOCK
When an asynchronous connection is complete, a call to the select() function indicates that the
file descriptor for the socket is ready for writing.
RETURN VALUES
Upon successful completion, the spt_connectx() function returns the value 0 (zero). Otherwise,
the value -1 is returned and errno is set to indicate the error.
If the socket becomes invalid (is closed by another thread), -1 is returned with an errno value of
[EBADF]. If a signal is received via the pthread_kill() function and is not blocked, ignored, or
handled, -1 is returned with an errno value of [EINTR].
ERRORS
If any of the following conditions occurs, the connect() function sets errno to the corresponding
value:
[EACCES] The socket is in the AF_UNIX domain and either search permission is denied for
a component of the pathname in the sockaddr structure, or write access to the
specified socket is denied.
[EADDRINUSE]
An attempt was made to establish a connection using addresses that are already
in use.
[EADDRNOTAVAIL]
The specified address is not available from this HP NonStop node.
[EAFNOSUPPORT]
Addresses in the specified address family cannot be used with this socket.
527186-005 Hewlett-Packard Company 7−101