IrDA and closesocket

The Windows Sockets closesocket function initiates a graceful close on the connection, and releases the socket handle.

The following sample demonstrates using the closesocket functions for an IrDA application:

if (closesocket(Sock) == SOCKET_ERROR)
{
    // call WSAGetLastError
}