Microsoft Windows CE 3.0  

WSACleanup

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function terminates the use of Winsock.dll.

int WSACleanup()

Return Values

Zero indicates success. SOCKET_ERROR indicates failure. To get a specific error value, call WSAGetLastError.

In a multithreaded environment, WSACleanupterminates Windows Sockets operations for all threads.

Remarks

This function initiates no action and is provided only for compatibility reasons.

An application or DLL is required to perform a successful WSAStartupcall before it can use Windows Sockets services. When it has completed the use of Windows Sockets, the application or DLL must call WSACleanupto deregister itself from a Windows Sockets implementation and allow the implementation to free any resources allocated on behalf of the application or DLL.

Sockets that were open when WSACleanupwas called are reset and automatically deallocated as if closesocketwere called; sockets that have been closed with closesocketbut that still have pending data to be sent can be affected-the pending data can be lost if the Winsock.dll is unloaded from memory as the application exits. To insure that all pending data is sent, an application should use shutdownto close the connection, then wait until the close completes before calling closesocketand WSACleanup. All resources and internal state, such as queued un-posted messages, must be deallocated so as to be available to the next user.

There must be a call to WSACleanupfor every successful call to WSAStartupmade by a task. Only the final WSACleanupfor that task does the actual cleanup; the preceding calls simply decrement an internal reference count in the Winsock.dll.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winsock.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

WSAStartup