What do the TCP flags SYN, ACK, FIN and RST mean?
SYN starts a connection and syncs sequence numbers, ACK acknowledges received data, FIN politely closes one direction, and RST aborts the connection immediately. PSH asks the receiver to hand data to the app without waiting.
Explain it simply
Treat a TCP connection like a phone call. SYN is dialling, ACK is "yes, got that", FIN is "I have nothing more to say, bye", and RST is slamming the phone down because you got a wrong number.
Example
SYN start; carries initial sequence number
ACK acknowledgement number is valid (set on almost every packet after SYN)
FIN sender has finished sending
RST reset: connection refused or broken, drop everything
PSH deliver to application nowWhen you connect to a port where nothing is listening, the server's OS replies with RST, and you see "connection refused". If a firewall silently drops the SYN instead, you see no reply and the attempt times out. That difference helps diagnose problems: refused means the host is reachable but the port is closed, while a timeout suggests filtering or an unreachable host.
An RST also arrives if one side crashed and the other keeps sending on the old connection.
What to say in the interview
"SYN opens, ACK confirms, FIN closes gracefully, RST aborts. A reset means connection refused or an invalid connection, while silence usually points to a firewall dropping packets."
Common mistakes
- Thinking RST and FIN are the same. FIN is orderly; RST discards unsent data.