WSAAcceptThe Windows Sockets WSAAccept function conditionally accepts a connection based on the return value of a condition function, and optionally creates and/or joins a socket group. SOCKET WSAAccept (
| SOCKET s,
| struct sockaddr FAR * addr,
| LPINT addrlen,
| LPCONDITIONPROC lpfnCondition,
| DWORD dwCallbackData
IN LPWSABUF lpCallerId,
IN LPWSABUF lpCallerData,
IN OUT LPQOS lpSQOS,
IN OUT LPQOS lpGQOS,
IN LPWSABUF lpCalleeId,
OUT LPWSABUF lpCalleeData,
OUT GROUP FAR * g,
IN DWORD dwCallbackData
); ConditionFunc is a placeholder for the application-supplied function name. In 16-bit Windows environments, it is invoked in the same thread as WSAAccept, thus no other Windows Sockets functions can be called except WSAIsBlocking and WSACancelBlockingCall. The actual condition function must reside in a DLL or application module and be exported in the module definition file. You must use MakeProcInstance to get a procedure-instance address for the callback function. The lpCallerId and lpCallerData are value parameters which contain the address of the connecting entity and any user data that was sent along with the connection request, respectively. If no caller ID or caller data is available, the corresponding parameters will be NULL. lpSQOS references the flow specifications for socket s specified by the caller, one for each direction, followed by any additional provider-specific parameters. The sending or receiving flow specification values will be ignored as appropriate for any unidirectional sockets. A NULL value for lpSQOS indicates no caller supplied QOS. QOS information can be returned if a QOS negotiation is to occur. lpGQOS references the flow specifications for the socket group the caller is to create, one for each direction, followed by any additional provider-specific parameters. A NULL value for lpGQOS indicates no caller-supplied group QOS. QOS information can be returned if a QOS negotiation is to occur. The lpCalleeId is a value parameter which contains the local address of the connected entity. The lpCalleeData is a result parameter used by the condition function to supply user data back to the connecting entity. lpCalleeData->len initially contains the length of the buffer allocated by the service provider and pointed to by lpCalleeData->buf. A value of zero means passing user data back to the caller is not supported. The condition function should copy up to lpCalleeData->len bytes of data into lpCalleeData->buf, and then update lpCalleeData->len to indicate the actual number of bytes transferred. If no user data is to be passed back to the caller, the condition function should set lpCalleeData->len to zero. The format of all address and user data is specific to the address family to which the socket belongs. The result parameter g is assigned within the condition function to indicate the following actions:
- if &g is an existing socket group ID, add s to this group, provided all the requirements set by this group are met; or
- if &g = SG_UNCONSTRAINED_GROUP, create an unconstrained socket group and have s as the first member; or
- if &g = SG_CONSTRAINED_GROUP, create a constrained socket group and have s as the first member; or
- if &g = zero, no group operation is performed.
||A successful WSAStartup must occur before using this function.
||The connection request was forcefully rejected as indicated in the return
value of the condition function (CF_REJECT).
||The network subsystem has failed.
||The addrlen argument is too small or the lpfnCondition is not part of the user address space.
||The (blocking) call was canceled through WSACancelBlockingCall.
||A blocking Windows Sockets 1.1 call is in progress.
||listen was not invoked prior to WSAAccept, parameter g specified in the condition function is not a valid value, the source address
of the incoming connection request is not consistent with that of the
constrained group the parameter g is referring to, the return value of the condition function is not a valid
one, or any case where the specified socket is in an invalid state.
||The queue is nonempty upon entry to WSAAccept and there are no socket descriptors available.
||No buffer space is available.
||The descriptor is not a socket.
||The referenced socket is not a type that supports connection-oriented service.
||The acceptance of the connection request was deferred as indicated in the
return value of the condition function (CF_DEFER).
||The socket is marked as nonblocking and no connections are present to be
||The connection request that was offered has timed out or been withdrawn.
- Software for developers
Software for Android Developers
- More information resources
Unix Manual Pages