Disconnecting the Server
Once the server is completed receiving data from the client and sending data back to the client, the server disconnects from the client and shutdowns the socket.
To disconnect and shutdown a socket
- When the server is done sending data to the client, the shutdown function can be called specifying SD_SEND to shutdown the sending side of the socket. This allows the client to release some of the resources for this socket. The server application can still receive data on the socket.
- When the client application is done receiving data, the closesocket function is called to close the socket.
When the client application is completed using the Windows Sockets DLL, the WSACleanup function is called to release resources.
- Getting Started With Winsock
- Winsock Server Application
- Receiving and Sending Data on the Server
- Running the Winsock Client and Server Code Sample