Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

connect(2) OSS System Calls Reference Manual
If the initiating socket is connection-oriented (has the type SOCK_STREAM), then the
connect() function attempts to make a connection to the socket specified by the address
parameter. Sockets of type SOCK_STREAM can successfully connect only once.
When a connection cannot be created immediately and O_NONBLOCK is not set for the file
descriptor of the socket, the connect() call blocks until one of the following occurs:
A connection is established
A timeout occurs
A signal is caught
If timeout occurs, the connect() call fails and errno is set to [ETIMEDOUT]; the connection is
aborted.
If a connect() call is interrupted by a signal that is caught while the call is blocked waiting to
establish a connection, the connect() call fails and sets errno to [EINTR]; the connection 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 connect() call fails and sets errno to [EINPROGRESS]; the connec-
tion is not aborted and is later established asynchronously. Subsequent calls to the connect()
function for the same socket before the connection is completed will fail and set errno to [EAL-
READY].
NOTES
This function requires that the feature-test macro _XOPEN_SOURCE_EXTENDED be specified
when you compile the module.
When an asynchronous connection is complete, a call to the select() function indicates that the
file descriptor for the socket is ready for writing.
To use the connect() functionality in a threaded application that uses the Standard POSIX
Threads library, see spt_connectx(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
To use this function in a 32-bit threaded application that uses the POSIX User Thread Model
library on systems running H06.24 or later RVUs or J06.13 or later RVUs, perform the same
tasks (described above) used to enable the function on systems running H06.21/J06.10 or later
RVUs.
To use this function in a 64-bit threaded application that uses the POSIX User Thread Model
library on systems running H06.24 or later RVUs or J06.13 or later RVUs, you must perform all
of the following tasks:
Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
138 Hewlett-Packard Company 527186-023