Disconnecting an Endpoint-to-Endpoint Connection
The following figure shows how TDI clients release an endpoint-to-endpoint connection.
Disconnection behavior is transport-specific in nature. When a connection-oriented TDI client initiates a disconnect between nodes, both nodes might need to participate in the disconnection operation. That is, when one client initiates a disconnect, the remote-node client possibly must respond to it.
During a disconnect operation, the TDI transport driver usually refuses incoming requests on the open connection endpoint and stops all activity at the specified connection endpoint unless both transports support controlled disconnects and the initiating client requests one.
As the preceding figure shows, one client on an endpoint-to-endpoint connection can initiate a disconnection operation by submitting a TDI_DISCONNECTrequest, set up with TdiBuildDisconnect, to its underlying transport. When that transport finishes processing the initiating client's request, it notifies the remote-node transport driver that a disconnection is in progress, and this transport begins returning an appropriate status code for client-submitted I/O requests on the endpoint-to-endpoint connection.
If the responding client registered its ClientEventDisconnecthandler, the TDI transport driver notifies the client when the disconnect occurs by calling this handler. Then, ClientEventDisconnect acknowledges the disconnection by making a TDI_DISCONNECT request to its underlying transport. This notification allows the responding client to clean up client-allocated state for the endpoint-to-endpoint connection promptly.
However, a disconnection operation does not close either client's open connection endpoints or transport addresses. After TDI_DISCONNECT requests have been satisfied, both clients can reuse the file objects representing these open resources in their underlying transports. For example, either client might make a subsequent connection offer to another remote node on the network, as already described in Making an Endpoint-to-Endpoint Connection. Until each client closes the file objects representing its respective connection endpoint and the associated transport address as described in Closing a Connection Endpointand Closing a Transport Address or Control Channel, respectively, these resources remain allocated to the client and available for client-submitted IOCTL requests to the underlying transport.
Note The TDI feature is deprecated and will be removed in future versions of Microsoft Windows. Depending on how you use TDI, use either the Winsock Kernel (WSK) or Windows Filtering Platform (WFP). For more information about WFP and WSK, see Windows Filtering Platform and Winsock Kernel. For a Windows Core Networking blog entry about WSK and TDI, see Introduction to Winsock Kernel (WSK).