Home |
Sockets, IP, and Port Addresses Blocking and Non-Blocking Sockets Closing a TCP Connection |
Closing a TCP ConnectionIn order to close a connection, a handshake of FIN packets and acknowledgments of the FIN packets is done. When there is no more data which needs to be sent, the application can call closesocket. Data may still be received after closesocket has been called, i.e. it only shuts down data transfer in one direction. When closesocket is called, a FIN message is sent to the remote host. The socket is not freed until the handshake is complete.
|