WSACleanup

WSACleanup terminates use of the RT-TCP/IP stack within an RTSS process.

Syntax

int WSACleanup(void);

Parameters

None

Return Value

0 (zero) if the function succeeds, SOCKET_ERROR if the function fails

Use WSAGetLastError to retrieve a specific error code.

Remarks

An application must perform a number of WSACleanup calls equal to the number of WSAStartup calls, which would decrement a startup count. The last call would perform an actual cleanup.

If the process exits without calling WSACleanup (number of times equal to WSAStartup), or is killed by RtssKill, RTX64 will attempt to perform an equivalent to WSACleanup before performing the remainder of RtProcessTerminate.

In some cases if the process crashes, the RT-TCP/IP stack is unable to perform a proper application cleanup. Usually this occurs if the application has not completed a Winsock API call. In this scenario, a warning message is printed to the RTX64 Server console, requesting to restart the stack. All other Winsock processes must be terminated before the stack is restarted.

This scenario might also occur when an application is run under the debugger, Stop Debugging is issued, and the application is stopped on a breakpoint.

Requirements

Minimum Supported Version RTX64 2013
Header Winsock2.h
Library RtTcpip.lib