WSACleanup

WSACleanup terminates use of the eRTOS TCP/IP stack within a 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.

Use WSAGetLastError to retrieve a specific error code.

Remarks

An application must perform several 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 Kill, eRTOS will attempt to perform an equivalent to WSACleanup before performing the remainder of RtProcessTerminate.

In some cases, if the process crashes, the eRTOS 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 to the eRTOS 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

eRTOS 1.0 SDK

Winsock2.h RtTcpipApi.lib