Introduction to TCP
TCP connections can be terminated in 2 ways –
- TCP Fin
- TCP RST
In this article, we will understand more about TCP RST Flag and its related nuances.
Related – TCP FIN VS RST Packets
TCP RST is more of a hard way which immediately terminates the connection (TCP RST is less chatty than TCP FIN packet)
TCP RST Flag
The TCP RST flag indicates that connection should be immediately terminated, and this happens mostly because of a fatal error. If in case, the connection has already been closed or idle from one side (side A) and the other side (side B) suddenly comes back and wishes to continue the session for data transfer, host (side A) usually responds by sending a RST packet back to the same connection and stating that no longer interested in data transfer. RST bit will be set to high in the TCP header flag.
- The packet is an initial SYN packet trying to establish a connection to a server port on which no process is listening.
- The packet arrives on a TCP connection that was previously established but the local application has already closed its socket or exited and the OS has closed the socket.
Other circumstances are also possible but are unlikely such as attempts to hijack a TCP connection.
Related – TCP FLAGS
Diagnostic Codes for TCP/IP CONNECTION RESET Report
CODE AND TEXT | DESCRIPTION |
---|---|
0 Unknown | A reset was received from the remote system. |
1 Frame Received for Unknown Socket Pair | A TCP frame was received for a connection that does not currently exist. |
2 TCP ACK Indication Received in Invalid State | A TCP layer detected an error in the TCP protocol. This implies that the remote side is not issuing the correct protocol. |
3 TCP SYN Indication Received in Invalid State | A TCP layer detected an error in the TCP protocol. This implies that the remote side is not issuing the correct protocol. |
4 Security Precedence Failure | Reserved for future use. |
5 Update Sub file Failure | Indicates an internal software error. An attempt to update information for a sub file failed. This is considered as a fatal error for the connection. |
6 Application Abort | The local application issued a close (abort) and did a block exit where the port file was declared or DSed. All cases cause a reset to be sent. |
7 Logical I/O Interface Establishment Failed | Indicates an internal software error. The interface between the TCP layer and logical I/O failed to establish. |
8 Unexpected Connection Destroy Invoked | Indicates an internal software error. The logical I/O notified the TCP layer to remove the data structure for a connection, but the connection is not closed. |
9 Reset Due to ICMP Destination Unreachable Message | An ICMP destination unreachable message for the remote system was received. |
10 Reset Due to an Invalid State Transition | Indicates an internal software error. An attempt to change the file state failed. |
11 SYN Received for Unknown Port | A TCP SYN frame was received for a connection that does not currently exist. |
12 Sub file Open Attempt Failed | Indicates an internal software error. The file state cannot be set to OPEN. |
13 Reset Due to SNMP Request | The SNMP protocol allows a TCP connection to be deleted. The local system received the appropriate SNMP command for deleting a connection |
14 Max Connections Exceeded | The maximum number of TCP/IP connections has been exceeded |
15 No Response Received for SYN | The initial SYN frame timed out |
16 Application Closed with Data to Read | The application issued a close while data was queued to be read |
17 Keep Alive packet Limit Exceeded | Valid only for connections using the Keep Alive option. The keep alive packets were not responded to in the designated time limit |
Download the table here.
Conclusion
TCP RST is a closure of the session which causes the resources allocated to the connection to be immediately released and connection is terminated. TCP reset is identified by the RST flag in the TCP header set to 1.
Continue Reading:
Difference between TCP and UDP
ABOUT THE AUTHOR
I am here to share my knowledge and experience in the field of networking with the goal being – “The more you share, the more you learn.”
I am a biotechnologist by qualification and a Network Enthusiast by interest. I developed interest in networking being in the company of a passionate Network Professional, my husband.
I am a strong believer of the fact that “learning is a constant process of discovering yourself.”
– Rashmi Bhardwaj (Author/Editor)