TCP Session TerminationThe FIN TCP flag is used to terminate a TCP connection.When the client has no more data to send in the stream, it sends a segment with the FIN flag set.The server sends an ACK to acknowledge the receipt of the FIN to terminate the session from client to server.The server sends a FIN to the client to terminate the server-to-client session.The client responds with an ACK to acknowledge the FIN from the server.When all segments have been acknowledged, the session is closed.