Stop using Windows Sockets DLL.
# Include <Winsock. h>
Int Pascal far wsacleanup (void );
Before using the Windows Sockets service, applications or dll must make a successful wsastartup () call. after using Windows Sockets, the application or dll must call wsacleanup () to unregister it from the implementation of Windows Sockets, and this implementation releases any resources allocated to the application or DLL. any interface of the sock_stream type that is enabled and has established a connection will be reset when wsacleanup () is called () if you disable the set of APIs that still need to send the pending data, the interface will not be affected-the data will still be sent.
Each wsastartup () call of a task must have a wsacleanup () call. only the last wsacleanup () is used for actual clearing. The previous call only degrades the built-in reference count in Windows Sockets DLL. A simple application can call wsacleanup () continuously in a loop to return wsanotinitialised.
Returned value: the operation is successful. socket_error. Otherwise, you can call wsagetlasterror () to obtain the error code.
A common Windows Sockets programming error is: attempting to call wsacleanup () in a blocking hook function and detecting the return value failed. if the application needs to exit when a blocking call is in progress, the application must first invalidate the blocking operation by calling wsacancelblockingcall, then start wsacleanup () once the control is returned to the application ().
A good Windows Sockets application will call wsacleanup () to indicate that it is logged out of the Windows Sockets implementation. This function can be used to release resources allocated to the specified application.
In a multi-threaded environment, wsacleanup () suspends the operation of Windows Sockets on all threads.
Use with caution:
Because wsacleanup () is called, the socket initialization resource is deregistered from the implementation of Windows Sockets, And the implementation is released as any resources allocated by the application or DLL. Therefore, wsastartup () is not called when writing the IE space, but wsacleanup () is called, or the page abnormal request is interrupted, unexpected ie browsing ......