TCP/IP Programming Manual

struct sockaddr *from_ptr;
long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error := accept_nw2 (new_socket, from_ptr, tag);
INT(32) error;
INT(32) new_socket;
INT .EXT from_ptr(sockaddr_in);
INT(32) tag;
error
return value; f 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 96).
new_socket
input value; the socket number for the new socket on which the connection is to be accepted,
as returned by a call to socket_nw.
from_ptr
input value; points to the address and port number returned from the call to accept_nw or
accept_nw1.
tag
input value; the tag parameter to be used for the nowait operation.
Errors
If an error occurs, the external variable errno is set to one of the following values:
accept_nw2() posted on an already-bound socket. (For Parallel Library TCP/IP and
NonStop TCP/IPv6 only.)
EADDRINUSE
Operation is already in progress. (For Parallel Library TCP/IP and NonStop TCP/IPv6
only.)
EALREADY
The connection was reset by the peer process before the accept operation completed.
This error also can be received when a call was done on a socket when the socket
was in an incorrect state.
ECONNRESET
An invalid argument was specified.EINVAL
Socket is already connected. (For Parallel Library TCP/IP and NonStop TCP/IPv6
only.)
EISCONN
No Buffer Space available. (For Parallel Library TCP/IP and NonStop TCP/IPv6 only.)ENOBUF
The socket specified in the new_socket parameter was invalid. Close the socket
using the FILE_CLOSE call. Repeat the accept_nw, socket_nw and accept_nw2
sequence of calls.
ERSCH
Usage Guidelines
This is a nowait call; it must be completed with a call to the AWAITIOX procedure. For a
waited call, use accept.
The accept_nw and accept_nw2 functions work together. The accept_nw function checks
for connections on an existing nowait socket. When a connection request arrives, it returns
the address and port number from which the connection request came. A new socket is then
created with socket_nw. Finally, the new socket number returned by socket_nw and the
96 Library Routines