Partager via


Enhanced Functionality at Connect Time

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Winsock offers an expanded set of operations that can occur in addition to establishing a socket connection. The service provider requirements for implementing this additional functionality are described in the following sections.

Conditional Acceptance

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 identifier. 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.

Exchanging User Data at Connect Time

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 through 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).

Establishing Socket Groups

All use of Group Sockets is reserved.

See Also

Concepts

Socket Connections on Connection-Oriented Protocols