Home  >  Q&A  >  body text

linux - 应用层TCP的确认机制

巴扎黑巴扎黑2716 days ago472

reply all(5)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 15:55:26

    You mean TCP protocol?
    The TCP protocol itself includes mechanisms for confirmation of delivery and automatic retransmission. As long as you use TCP connections, you don’t need to consider this issue.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 15:55:26

    TCP is a protocol that is generally implemented by your machine equipment. You do not need to pay attention to TCP retransmissions. Generally, your application layer, such as HTTP, and the network layer are TCP. When calling the HTTP protocol, you do not need to pay attention to the implementation of the lower layer protocol. The lower layer network protocol is transparent to the upper layer protocol

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 15:55:26

    Let’s discuss it with you using the Modbus protocol mechanism. The communication between the master station and the slave station belongs to the request-response mechanism. When the master station sends a request to the slave station, if the slave station does not reply in time, after the delay time expires, the master station will send the request to the slave station 5 times in a row. The timeout and the number of retransmissions are used to ensure that each request is successful as much as possible. If the retransmission fails 5 times, it is judged that the transmission failed. At this time, the physical link may be abnormal, and subsequent unfinished data will not be sent. Send again.

    reply
    0
  • PHPz

    PHPz2017-04-17 15:55:26

    TCP is a reliable transmission protocol. For every packet you send, the peer needs ACK confirmation.
    For example, if you send 5 packets to the peer, and packet No. 3 is lost,
    Then when the peer receives No. 4 When receiving the packet, the peer will send you ACK 3, and at the same time, the peer will save packet No. 4. When the peer receives packet No. 5, the peer will still send you ACK 3, and at the same time, the peer will save packet No. 5. Packet No. 3 is saved.
    In the TCP protocol, when you receive 3 consecutive "ACK 3"s, you will know that packet No. 3 is lost and needs to be resent. This is called the fast retransmission mechanism.

    When you resend packet No. 3 to the peer, the peer will respond with ACK 6 after receiving it successfully, because the peer has successfully received packet No. 4 and No. 5 before.

    This is guaranteed by TCP for you.

    If packet No. 3 still fails after being retransmitted multiple times at the TCP layer, then the entire transmission has failed.
    You need to check the network connection and resend it at the application layer.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:55:26

    No need, what you mentioned is implemented by the TCP protocol layer, you just use it.
    If you want to know the details, you can refer to this article

    reply
    0
  • Cancelreply