0

we know that when TCP data is received with PSH set, it will immediately transfer the received data to the application.and let's when pushed data arrives the receiver side and the receiver application is not reading any data(busy with other tasks). then how does the receiver pass the data to its application process since the receiver's process is not even reading data?

2

The PSH flag causes the sender's stack to immediately send out the next data segment, without collecting more data. The receiver's stack doesn't wait for more data either and passes the segment's data to the application immediately. If the receiving application is slow or doesn't read the data at all, that's where it gets stuck. The PSH flag can't magically wake up a dead process.

Without PSH, sending small data chunks may be delayed when the sender (or receiver) stack waits for more data to fill up a segment (or buffer). This can significantly reduce processing and protocol overhead when data is produced only in small chunks.

   If the PUSH flag is set, the data must be transmitted promptly
   to the receiver, and the PUSH bit will be set in the last TCP
   segment created from the buffer.  If the PUSH flag is not set,
   the data may be combined with data from subsequent SENDs for
   transmission efficiency.

RFC 793

Note the similarity with URG that is something different still, as it signals the receiver stack to press URGent data that the application should process out of order.

Typical examples for PUSH is a console application (telnet) that sends each key separately and would suffer severe lag without PUSH. URG can be used to signal a break / stop / reset in such an application: stop running output instead of outputting everything in line and then waiting for/processing the next user input.

| improve this answer | |
  • Thanks for your answer. still a little bit confused, I think sender just uses some sort of push function to send all data in tis buffer,and PSH bit is mainly for receiver, which let the reiceiver to push all data in the buffer to the application. is my understanding correct? – amjad Aug 22 at 9:30
  • another question is, I know URG flag will trigger a SIGURG signal by operating system kernel so the application process can be notified that there is urgent data to process immediately, so why PSH flag doesn't trigger any signal to application process? – amjad Aug 22 at 9:33
  • The PUSH flag is for both sender and the receiver stacks to signal immediate forwarding, see quote. The larger effect should be on the sender side, but that depends on host implementations which are off-topic here. – Zac67 Aug 22 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.