Real world example for PSH flag?
Matthew Harrington
I am trying to understand the difference between the TCP PSH and URG flags. I know so far that when the PSH flag is set, the receiver device doesn't wait until the buffer is full - it just sends the data to the device.
But can someone give me a real world example for this so that I can understand the concept better?
I was going through article and though the explanation is very good, I am failing to understand the example given.
It says,
In packet #4, we see that the initial HTTP request has its PSH flag set, indicating that the client has no further data to add and the request should be sent up to the application (in this case, a web daemon) immediately
If in the above case, the client has no further data to send, why wouldn't it just send the packet with FIN flag set?
1 Answer
The client has no further data right now, but that doesn't mean it won't have any in the future.
You're assuming the protocol has exactly one request from the client (and exactly one response). That has not been the case for HTTP for a very long time – connection reuse for multiple requests existed even before HTTP/1.1, and is ubiquitous nowadays. The client submits a request, waits for response, then submits another request over the same connection, etc. The advantage of these long-lived connections is that it allows TCP flow control to reach the optimal state.
It is not the case for many other protocols either. For example, SMTP exchanges no less than 5 commands/responses in order to send an email, and the protocol specification explicitly forbids "pipelining" (sending all commands at once without waiting for response). This means a client needs to push a single line and have the server respond, push another line and have the server respond, etc.
And of course, many protocols are interactive – Telnet and SSH require the server to respond to every keystroke; VNC and RDP react to every mouse click.