Get the App
SLTechnology News&Howtos  ›  Network Security  › 

The difference between URG and PSH in TCP Protocol

Shulou Source: shulou.com Published: 2022-06-01 05:46:21 09月22日 Update

Both URG and PSH belong to the flag bits in the TCP header. When URG and PSH are 1, they both indicate that emergency data is currently available. The difference is that emergency data are handled differently.

URG: 1 indicates that the emergency pointer field is valid. It tells the system that there is emergency data in this message segment, which should be delivered as soon as possible, which is equivalent to a high priority, and no longer needs to be queued in the receiving queue. For example, when we want to use Ctrl+C to terminate a remote process, we set URG to 1, and the sending application process tells the sender that the TCP has urgent data to transmit, so the sender inserts the emergency data at the front of the data in this paragraph, and the data after the emergency data is still ordinary data. A message segment with a urg of 1 is delivered directly upstream without entering the receiving buffer.

In the TCP header, only the emergency pointer indicates the location of the emergency data, and the bytes it refers to are emergency data, but there is no way to specify the length of the emergency data.

PSH: 1 means that the message segment needs to be sent to the application process of the receiver as soon as possible. If there is an emergency that the application needs to deal with (such as hoping to get an immediate reply from the receiver), the sequenced piece of data in the receiving buffer will be handed over to the upper layer instead of waiting for the entire cache to be filled before it is delivered up.

Therefore, we usually say that URG is the emergency bit and PSH is the urgent bit.

-muhuizz finishing

Tags: Data messages processes applications differences pointers processing buffering normal valid upper layer no middle row event priority location method only fields bytes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MySQL Apple Shulou Information OPPO Reno