4人阅读 评论(0) 收藏 举报

To understand the function of the PSH flag, we first need to understand how TCP buffers data. TCP operates at layer four of the OSI model; it presents to upper layers a simple socket which can be read from and written to, masking the complexities of packet-based communications. To allow applications to read from and write to this socket at any time, buffers are implemented on both sides of a TCP connection in both directions.

The diagram below shows how data is buffered by the sender before sending, and by the receiver upon reception.


Buffers allow for more efficient transfer of data when sending more than one maximum segment size (MSS) worth of data (for example, transferring a large file). However, large buffers do more harm than good when dealing with real-time applications which require that data be transmitted as quickly as possible. 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: You would have to type over a thousand characters before the first packet would make it to the remote device. Not very useful.

This is where the PSH flag comes in. The socket that TCP makes available at the session level can be written to by the application with the option of “pushing” data out immediately, rather than waiting for additional data to enter the buffer. When this happens, the PSH flag in the outgoing TCP packet is set to 1 (on). Upon receiving a packet with the PSH flag set, the other side of the connection knows to immediately forward the segment up to the application. To summarize, TCP’s push capability accomplishes two things:

The sending application informs TCP that data should be sent immediately.
发送端 : TCP将数据包置上PUSH标志时,表示这个数据应该被立即发送,而不要等待额外的数据。
The PSH flag in the TCP header informs the receiving host that the data should be pushed up to the receiving application immediately.
接收端 : 接收端接受到带有PUSH标志的数据时,应该接接受缓存中收到的所有数据(包含当前带PUSH标示的数据包)应该立即提交到应用层。


TCP push

  • edison0716
  • edison0716
  • 2010-01-05 11:03:00
  • 5954


TCP的推送比特PSH(Push) PSH是TCP报头中的一个标志位,发送方在发送数据的时候可以设置这个标志位.当两个应用程序进行交互式的通信时,有时在一端的应用进程希望在键入一个命令后立即就能...
  • u012570105
  • u012570105
  • 2016-02-15 14:48:20
  • 504


系统调用read与recv读取socket缓存区 发送端系统调用write与push标志位及接收缓存区大小yupush标志位的关系...
  • ljl1704
  • ljl1704
  • 2016-06-03 13:58:07
  • 1211


TCP报文段首部最小长度是20个字节TCP报文段的首部格式 紧急URG(URGent): 当URG = 1时表明紧急指针字段有效,他告诉系统此报文段中有紧急数据,应尽快传送,而不要按原来的排队顺...
  • wenqiang1208
  • wenqiang1208
  • 2017-05-23 22:59:44
  • 610

tcp 6个标记位

tcp 6个标记位 1)URG:此标志表示TCP包的紧急指针域(后面马上就要说到)有效,用来保证TCP连接不被中断,并且督促中间层设备要尽快处理这些数据; (2)ACK:此标志表示应答域有...
  • chenfei_5201213
  • chenfei_5201213
  • 2012-04-12 13:51:49
  • 4004


TCP FLAG 标记 基于标记的TCP包匹配经常被用于过滤试图打开新连接的TCP数据包。 TCP标记和他们的意义如下所列: * F : FIN - 结束; 结束会话 * ...
  • hunanchenxingyu
  • hunanchenxingyu
  • 2014-05-22 12:51:36
  • 12832

tcp PUSH 标志的理解

PUSH标志 发送端  TCP将发送带有PUSH标志的数据包时,表示这个数据应该被立即发送,而不要等待额外的数据。 接收端接受到带有PUSH标志的数据时,接收进程接受到的所有数据(包含当前带PUS...
  • qiuybing
  • qiuybing
  • 2014-10-11 08:29:37
  • 1478


由于发送该数据会清空发送缓冲,所以要加上PUSH标志。(告诉接收者:所有数据已发送,马上送到应用层去。)这里所说的数据包括与此PUSH包一起传输的数据以及之前就为该进程传输过来的数据 设置PUS...
  • xiaofei0859
  • xiaofei0859
  • 2016-10-20 10:32:30
  • 165


转自: 整合一下。自己感觉该算法比ford-fulkerson更易编。 与F...
  • hjwang1
  • hjwang1
  • 2013-05-14 23:15:54
  • 731


当前在网络传输应用中,广泛采用的是TCP/IP通信协议及其标准的socket应用开发编程接口(API)。TCP/IP传输层有两个并列的协议:TCP和UDP。其中TCP(transport contro...
  • yusiguyuan
  • yusiguyuan
  • 2013-12-11 20:52:55
  • 1657
    访问量: 105万+
    积分: 1万+
    排名: 1966