简体   繁体   English

TCP FIN 字节值?

[英]TCP FIN byte value?

My question is really two parts:我的问题实际上是两个部分:

From the sender's perspective,从发件人的角度来看,

  1. in addition to TCP header FIN flag, is it true that TCP layer injects (or more like appending since it should be at the end of the stream) an artificial byte in the stream, meaning this byte is part of the TCP payload? in addition to TCP header FIN flag, is it true that TCP layer injects (or more like appending since it should be at the end of the stream) an artificial byte in the stream, meaning this byte is part of the TCP payload?
  2. if so, what is the value of this byte?如果是这样,这个字节的值是多少?

From the receiver's perspective,从接收者的角度来看,

  1. both TCP layer and application needs to know this FIN flag/byte. TCP 层和应用程序都需要知道这个 FIN 标志/字节。 So is it true that TCP layer only looks at the FIN flag, without special handling the byte in the stream?那么TCP层真的只看FIN标志,没有对stream中的字节进行特殊处理吗?
  2. How is the application notified?申请如何通知? By the FIN flag, OR, by this special byte in stream?通过 FIN 标志,或者,通过 stream 中的这个特殊字节?
  3. When is the application notified?什么时候通知申请? Right upon TCP layer receiving the segment with the FIN flag, OR, when that segment eventually bubbles up the receiver's TCP buffer?就在 TCP 层接收带有 FIN 标志的段时,或者,当该段最终冒泡接收器的 TCP 缓冲区时?
  4. If the application does not get special notification until the segment that has the FIN flag eventually bubbles up TCP buffer, it means TCP layer has to somehow mark the buffer, since the TCP header should be stripped already. If the application does not get special notification until the segment that has the FIN flag eventually bubbles up TCP buffer, it means TCP layer has to somehow mark the buffer, since the TCP header should be stripped already. So how does it mark the FIN?那么它是如何标记FIN的呢?

in addition to TCP header FIN flag, is it true that TCP layer injects (or more like appending since it should be at the end of the stream) an artificial byte in the stream, meaning this byte is part of the TCP payload? in addition to TCP header FIN flag, is it true that TCP layer injects (or more like appending since it should be at the end of the stream) an artificial byte in the stream, meaning this byte is part of the TCP payload?

No. There is no actual byte injected but only the TCP sequence number is increased so that it is clear that the ACK is for the FIN and not some previous data.没有。没有实际的字节注入,只是增加了 TCP 序列号,因此很明显 ACK 是针对 FIN 而不是一些先前的数据。

This means also that if the FIN is received no special byte is put into the socket buffer and delivered to the application but that the socket buffer is marked as done.这也意味着如果接收到 FIN,则不会将特殊字节放入套接字缓冲区并传递给应用程序,而是将套接字缓冲区标记为完成。 A read by the application on an empty and "done" socket buffer will return that there are no more data in the buffer and never will be and thus the application knows that the peer has stopped sending (ie socket shutdown for writing or socket closed).应用程序对空且“完成”的套接字缓冲区的读取将返回缓冲区中没有更多数据并且永远不会,因此应用程序知道对等方已停止发送(即套接字关闭以写入或套接字关闭) .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM