TCP/IP Programming Manual

error
return value; if the call is successful, a zero is returned. If the call is not successful, –1 is returned.
If the call failed, the external variable errno is set as indicated in Errors (page 191).
socket
input value; specifies the socket number for the socket, as returned by the call to socket or
socket_nw.
tag
input value; the tag parameter to be used for the nowait operation.
Errors
EINVAL: An invalid argument was specified.
ENOTCONN: The specified socket is not connected.
Usage Guidelines
This is a nowait call; it must be completed with a call to the AWAITIOX procedure.
See Nowait Call Errors (page 86) for information on error checking.
The application needs to keep a list of sockets which have been marked for reuse by this call.
When a socket would normally be closed, the close() call is replaced with the
sock_close_reuse_nw() call and the socket added to the list. If any sockets exist on this
list when an accept_nw() call completes, the socket() call can be omitted and the
accept_nw2() is passed the socket found on the list. The socket is then removed from the
list.
You must set the socket type as sock_stream_nonft instead of instead of the standard
sock_stream to use this call.
Table 15 Comparison of Socket Calls With and Without sock_close_reuse_nw
Without sock_close_reuse_nw()With sock_close_reuse_nw()
accept_nwaccept_nw
socket = socket_nwsocket = socket_nw
accept_nw2(socket)accept_nw2(socket)
......
close(socket)sock_close_reuse_nw(socket)
accept_nwaccept_nw
socket = socket_nwaccept_nw2(socket)
accept_nw2(socket)...
...sock_close_reuse_nw(socket)
close(socket)
When an application tries to mark a fault-tolerant socket (SOCK_STREAM) for reuse, error
EINVAL is returned. If the application ignores this error and continues to use the socket on it's
subsequent accept_nw2() function, error EWRONGID is returned.
socket, socket_nw
The socket function creates a socket for waited operations; the socket_nw function creates a
socket for nowait operations.
socket, socket_nw 191