Windows Sockets 2 offers an expanded set of operations that can occur coincident to establishing a socket connection. The service provider requirements for implementing these features are described below.
As described previously, WSPAccept invokes a client-supplied condition function that uses input parameters to supply information about the pending connection request. This information can be used by the client to accept or reject a connection request based on caller information such as caller ID, QOS, etc. If the condition function returns CF_ACCEPT, a new socket is created with the same properties as the listening socket, and a handle to the new socket is returned. If the condition function returns CF_REJECT, the connection request should be rejected. If the condition function returns CF_DEFER, the accept/reject decision cannot be made immediately, and the service provider must leave the connection request on the backlog queue. The client must call WSPAccept again, when it is ready to make a decision, and arrange for the condition function to return either CF_ACCEPT or CF_REJECT. While a deferred connection request is at the top of the backlog queue, the service provider does not issue any further indications for pending connection requests.
Some protocols allow a small amount of user data to be exchanged at connect time. If such data has been received from the connecting host, it is placed in a service provider buffer, and a pointer to this buffer along with a length value are supplied to the Windows Sockets SPI client via input parameters to the WSPAccept condition function. If the Windows Sockets SPI client has response data to return to the connecting host, it may copy this into a buffer that is supplied by the service provider. A pointer to this buffer and an integer indicating buffer size are also supplied as condition function input parameters (if supported by the protocol).
Note Reserved for future use with socket groups:
In the case of the condition function returning CF_ACCEPT, a new socket is created as mentioned above. Coincident with this socket creation, a socket group may be created or joined, depending on the value of output parameter g of the condition function. See WSPAccept for more information.