/fɪn/
n. “A control flag in TCP indicating the sender has finished sending data.”
In the context of the Transmission Control Protocol (TCP), FIN (short for finish) is a flag used to signal the termination of a TCP connection. When a device sends a FIN packet, it indicates that it has no more data to transmit, initiating the connection teardown process while allowing any remaining data to be received.
TCP connections require a reliable handshake to terminate gracefully. The FIN flag ensures that both sides of a connection acknowledge the end of data transmission and close the session without losing data.
Key characteristics of FIN include:
- Connection Termination: Marks the sender as finished transmitting data.
- Part of TCP Flags: Works alongside SYN, ACK, and RST flags.
- Reliable Closure: Ensures all transmitted data is acknowledged before closing.
- Half-Close Support: Allows one side to stop sending data while still receiving from the other side.
Conceptual example of FIN usage:
// TCP connection termination sequence
Client sends FIN to server
Server acknowledges with ACK
Server may send its own FIN
Client acknowledges server FIN
Connection fully closedConceptually, FIN is like politely saying “I’m done sending information” in a TCP conversation, allowing the other party to finish and acknowledge before both sides disconnect.