QsoStartAccept()--Start Asynchronous Accept Operation


  Syntax
 #include <sys/socket.h>
 #include <qsoasync.h>

 int QsoStartAccept (int socketDescriptor,int IOCompletionPort,
 Qso_OverlappedIO_t * communicationsArea)

        

  Service Program Name: QSOSRV3

  Default Public Authority: *USE

  Threadsafe: Yes

The QsoStartAccept() function is used to wait asynchronously for connection requests. If connection requests are queued, then QsoStartAccept() takes the first connection request on the queue and creates a new socket to service the connection request. If no connection requests are queued, then an asynchronous QsoStartAccept() request is pended onto the socket and will be transition to the specified I/O completion port once a connection arrives. This API only supports sockets with an address family of AF_INET or AF_INET6 and type SOCK_STREAM.


Parameters

socketDescriptor (Input)
The descriptor of the socket on which to wait.

int IOCompletionPort(Input)
The I/O completion port that should be posted when the operation completes.

Qso_OverlappedIO_t* communicationsArea (Input/Output)
A pointer to a structure that contains the following information:


Authorities

No authorization is required.


Return Values

QsoStartAccept() returns an integer. Possible values are:


Errno Conditions

When QsoStartAccept() fails, errno can be set to one of the following:



Error Messages



Usage Notes

  1. It is not recommended to intermix QsoStartAccept() and accept(). If this condition occurs, the order the requests will be serviced is undefined.

  2. The following are inherited by the descriptor returned by the accept() call:
    • All socket options with a level of SOL_SOCKET.
    • The status flags:
      • Blocking flag (set/reset either by the iocltl() call with the FIONBIO request or by the fcntl() call with the F_SETFL command and the status flag set to O_NONBLOCK).
      • Asynchronous flag (set/reset either by the ioctl() call with the FIOASYNC request or by the fcntl() call with the F_SETFL command and the status flag set to FASYNC).
    • The process ID or process group ID that is to receive SIGIO or SIGURG signals (set/reset by either the ioctl() call with the FIOSETOWN or the SIOCSPGRP request, or by the fcntl() call with the F_SETOWN command).


  3. Closing a socket causes any queued but unaccepted connection requests to be reset.
  4. A user exit point, QIBM_QSO_ACCEPT, exists to optionally accept or reject incoming connections being accepted based on the return code from the registered user exit program. For more information refer to Sockets accept() API Exit Program.

Related Information



API introduced: V5R1

[ Back to top | UNIX-Type APIs | APIs by category ]