admin管理员组文章数量:1410682
From what I read, a "Keepalive Packet" would be a packet without any payload, and with an ACK number. If this is the case, then how can the receiver know that the packet is a Keepalive packet and not an ACK packet? Because as far as I know, this is exactly how an ACK packet may be formatted.
And why does it have to differentiate between a Keepalive Packet and an ACK packet? Because a receiver doesn't send ACKs to an ACK Packet it receives, but it does send an ACK Packet when receiving a Keepalive Packet.
From what I read, a "Keepalive Packet" would be a packet without any payload, and with an ACK number. If this is the case, then how can the receiver know that the packet is a Keepalive packet and not an ACK packet? Because as far as I know, this is exactly how an ACK packet may be formatted.
And why does it have to differentiate between a Keepalive Packet and an ACK packet? Because a receiver doesn't send ACKs to an ACK Packet it receives, but it does send an ACK Packet when receiving a Keepalive Packet.
Share edited Mar 17 at 17:32 CS Student asked Mar 11 at 8:12 CS StudentCS Student 358 bronze badges1 Answer
Reset to default 2From what I read, a "Keepalive Packet" would be a packet without any payload, and with an ACK number. If this is the case, then how can the receiver know that the packet is a Keepalive packet and not an ACK packet? Because as far as I know, this is exactly how an ACK packet may be formatted.
It's an ACK packet which does not advance the TCP state. No new data has been transferred, so the sequence number being ACK'd did not increase.
TCP keepalive packets come in pairs:
First, peer A sends a 1-byte segment which pretends to re-transmit the last byte that was sent by re-using an already sent (and already acknowledged!) sequence number,
SEQ = SND.NXT minus 1
.(Like every other 'established' TCP packet, this too has the ACK flag set, but doesn't acknowledge anything new – just like the ordinary case of one peer sending data while the other is quiet.)
In return, peer B acknowledges the segment by sending what is effectively a duplicate ACK (a 0-byte segment that ACKs a sequence number that had already been ACK'd before).
(Peer B discards the segment's data because it has already received and properly ACK'd that seqno before, and already delivered the data to the appropriate socket.)
The Wireshark packet capture program recognizes this as a "TCP Keep-alive" because it tracks TCP flow state across the entire capture; if the same SEQ was already seen in the capture (plus several other conditions met) then the "keep-alive" label is added. (Which means that if you start capturing on an already live TCP connection, the first keep-alive pair will not be recognized as such by Wireshark.)
Similarly, Wireshark recognizes the 2nd packet as a "Keep-alive ACK" if it can reference it to a segment previously recognized as a "Keep-alive" segment. If it couldn't, then the packet would be labelled as merely "Duplicate ACK".
本文标签: network programmingWhat39s the difference between an ACK Packet and a Keepalive PacketStack Overflow
版权声明:本文标题:network programming - What's the difference between an ACK Packet and a Keepalive Packet - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744807676a2626248.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论