IPX/SPX Programming Manual

Library Routines
HP NonStop IPX/SPX Programming Manual528022-001
5-13
accept_nw
remote client’s IP address in the from_ptr sockaddr struct. This is an input
parameter.
tag
is 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:
Usage Guidelines
This is a nowait call; it must be completed with a call to the Guardian procedure
AWAITIOX. For a waited call, use accept.
For SPXII listener server applications, a call to bind and listen can precede a
call to accept.
The accept_nw function is designed to be followed first by a call to socket_nw to
create a new socket, then by a call to accept_nw2. The from_ptr parameter
from accept_nw is passed to accept_nw2, which accepts the connection on the
new socket.
Use accept_nw2 after this call.
For information on error checking, see Nowait Call Errors on page 5-5.
For information about struct sockaddr_nv and struct sockaddr, see
NonStop IPX/SPX Data Structures on page 4-2.
Example
The following SPXII server programming example calls accept_nw, socket_nw, and
accept_nw2. This call accepts a connection on the new socket fd2 created for
nowait data transfer:
#include <socket.h>
#include <nv.h>
#include <netdb.h>
...
struct sockaddr_nv from;
...
if ((fd1 = socket_nw(AF_NV, SOCK_STREAM,0,021,1)) < 0) {
perror (“Server Socket 1 create failed.”)
EALREADY There is already an outstanding call on the socket.
ECONNRESET The connection was reset by the peer process before the
accept_nw operation completed.
EINVAL An invalid argument was specified.