zoukankan      html  css  js  c++  java
  • packet duplication

    Duplicate Packets

    Duplicate packets are an often observed network behaviour.

    A packet is duplicated somewhere on the network and received twice at the receiving host. It is very often not desireable to get these duplicates, as the receiving application might think that's "fresh" data (which it isn't).

    If a sending host thinks a packet is not transmitted correctly because of a PacketLoss, it might Retransmit that packet. The receiving host might already got the first packet, and will receive a second one, which is a duplicated packet.

    ConnectionOrientedProtocols such as TCP will detect duplicate packets, and will ignore them completely.

    ConnectionlessProtocols such as UDP won't detect duplicate packets, because there's no information in, for example, the UDP header to identify a packet so that packets can be recognized as duplicates. The data from that packet will be indicated twice (or even more) to the application; it's the responsibility of the application to detect duplicates (perhaps by supplying enough information in its headers to do so) and process them appropriately, if necessary.

    Reasons

    There are two things you could mean be duplicate packets: duplication of the payload (the data being sent) or an exact duplicate of the payload and headers.

    TCP will attempt to resend data that it doesn't receive an ACK (acknowledgement from the receiver that the packet arrived okay) for. However, this leads to the famous "two Generals" problem where you can never be sure of the data actually arrived, or if you just didn't get the ACK because the ACK packet was lost. The receiver could have gotten the packet, replied with an ACK, but the ACK was then lost. In this case, the sender will assume the packet was never received, and send another packet with the same payload duplicated. Because of this case, protocols like TCP need to handle getting the data sent multiple times.

    The second thing duplicate packets could mean an actual 100% duplicate packet (payload and headers). This could happen because of errors in software, hardware, or routing problems or misconfigurations. In this case no, it's a somewhat different problem than TCP intentially sending new packets with duplicate payload from detection of packet loss. In this case the sender only sent one packet, but it was duplicated somewhere along the way by routers or hardware interfaces.

    Solutions

    TCP handle duplicated IP packets problem, so you don't care about them.

    UDP doesn't handle them. When you receive a datagram it's not guaranteed that you didn't have received the same datagram before. You should check it.

  • 相关阅读:
    VMware安装Linux时'Operating System Not Found'的解决方法
    [NLP自然语言处理]谷歌BERT模型深度解析
    【NPM】npm ERR! Unexpected end of JSON input while parsing near '...",'解决方案
    【前端基础系列】slice方法将类数组转换数组实现原理
    【读书笔记】理解基本排序算法
    【读书笔记】《人工智能简史》
    【前端基础系列】理解bind方法使用与实现
    【前端基础系列】理解GET与POST请求区别
    HTTPS工作原理
    微信WebView关闭后本地cookie无法清除问题
  • 原文地址:https://www.cnblogs.com/wordchao/p/10749384.html
Copyright © 2011-2022 走看看