Tech tips

TCP Header (Flags – PUSH) # 2.4

Welcome to Blog Post  # 5

No matter what you’re going through, there’s a light at the end of the tunnel.- Demi Lovato

In this, we will discuss TCP Flags “PUSH”

Key Takeaway :

  • TCP PUSH Flag

We have seen the PUSH Flag in every TCP example but never describe its use-case. 

It’s a notification from the sender to the receiver to pass all the data at the receiving process.

To understand the Push Flag, we first need to understand how TCP buffers data.

TCP operates in the transport layer. It present to the upper layer a simple socket. To allow the Application Layer to read from and write to this socket at any time, a buffer implement on both sides of a TCP connection.

Buffers allow for more efficient transfer of data when sending more than one MSS worth of data.

Consider what would happen to a Telnet session for instance if TCP waited until there was enough data to fill a packet before it would send one.

This is where a PSH flag comes in. The socket is available at the session layer present by the application with the option of “Pushing” data out immediately rather than waiting for additional data to enter the buffer.

The PSH flag set to 1 in the outgoing TCP packet. Upon receipt of a packet with the PSH flag set, the other side of the connection knows to immediately forward the segment up to the application.

Push Flag capable of two things :

  • Sending application informs TCP that data should be sent immediately.
  • The PSH flag in the TCP header informs the receiver that the data should be push up to the receiving application immediately.

Example : 

PSH Flag is set in segment 12, the final segment.

Why PSH Flag is set in Segment 7? As the sender knows there were more bytes to send.

The reason is that the sender sends a buffer in 4096.

Comment here