WSACleanup

WSACleanup terminates the use of the TCP/IP Stack within an RTSS process.

Syntax

Copy
int WSACleanup(void);

Parameters

None.

Return Value

If the function succeeds, it returns 0 (zero). If the function fails, it returns SOCKET_ERROR. Call WSAGetLastError to retrieve a specific error code.

Remarks

An application must perform several WSACleanup calls equal to the number of WSAStartup calls, which would decrease 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, wRTOS will attempt to perform an equivalent to WSACleanup before performing the remainder of RtProcessTerminate.

In some cases, if the process crashes, the TCP/IP Stack cannot perform a proper application cleanup. This usually occurs if the application has not completed a Winsock API call. In this scenario, a warning message is printed on the wRTOS Server console requesting that the Stack be restarted. 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 Header Library

wRTOS 1.0 SDK

winsock2.h

RttcpipApi.lib