Search

CN-122027108-A - Method and system for detecting time consumption of network packet transmission in P2P network in real time

CN122027108ACN 122027108 ACN122027108 ACN 122027108ACN-122027108-A

Abstract

The invention discloses a method and a system for detecting time consumption of network packets in P2P network transmission in real time, comprising the following steps of S1, establishing a high-precision time reference, executing time interaction for a plurality of times at a device end or an APP end, determining a final fixed time difference reference at round trip delay data of calculated time, S2, transmitting and marking the data packets, transmitting the data packets with transmission time stamps at the device end or the APP end, S3, receiving and consuming time calculation, receiving the data packets with the transmission time stamps at the device end or the APP end, recording the current receiving time stamps, calculating actual transmission time consumption according to the transmission time stamps, the receiving time stamps and the fixed time difference reference, S4, monitoring the transmitted time consumption data in real time, and dynamically updating the time difference reference according to the monitored data. The invention has the advantages of accuracy and reliability, and solves the problems that the calculation time consumption measurement is inaccurate and the network fluctuation interference is easy to occur when the traditional P2P network communication transmits the network packet.

Inventors

  • LIU MALIANG
  • HE PENGFEI
  • SHENG JINPING

Assignees

  • 深圳市探鸽智能科技有限公司

Dates

Publication Date
20260512
Application Date
20260326

Claims (10)

  1. 1. A method for detecting the time consumption of network packets in a P2P network in real time, comprising the steps of: S1, establishing a high-precision time reference, executing multiple time interactions at an equipment end or an APP end, calculating round trip delay data of time, and determining a final fixed time difference reference; s2, transmitting and marking the data packet, and transmitting the data packet with the transmission time stamp by the equipment end or the APP end; S3, receiving and consuming time calculation, wherein the equipment end or the APP end receives the data packet with the sending time stamp, records the current receiving time stamp, and calculates the actual transmission consuming time according to the sending time stamp, the receiving time stamp and a fixed time difference reference; And S4, real-time monitoring is carried out, the transmission time-consuming data is monitored in real time, and the time difference reference is dynamically updated according to the monitored data.
  2. 2. The method for detecting time consuming transmission of network packets in a P2P network in real time according to claim 1, wherein when a plurality of time interactions are performed in S1, N times of network time synchronization requests are initiated between equipment ends or APP ends, time data of each interaction is recorded, and a plurality of groups of original time data are obtained.
  3. 3. The method for detecting the time consumption of network packets transmitted in a P2P network in real time according to claim 2, wherein after a plurality of groups of original time data are obtained, an abnormal data group is identified and removed, the abnormal data group is identified through a difference method, the abnormal data is labeled, and the labeled abnormal data is replaced by a connecting line value of a front normal point and a rear normal point.
  4. 4. The method for detecting the time consumption of network packets in real time during P2P network transmission according to claim 3, wherein when the round trip delay data of time is calculated in S1, the corresponding round trip delay is calculated for each synchronous request, the average value of all the N round trip delay data is calculated, the data sets exceeding the effective interval are identified and removed, the effective interval is the numerical range of the average value plus the standard deviation, the interference caused by the severe fluctuation of the network is eliminated, the average value of the time difference corresponding to the remaining effective data sets is taken as the fixed time difference reference between the equipment end and the APP end.
  5. 5. The method for detecting the time consuming of network packets in real time during P2P network transmission according to claim 1, wherein when the data packets with the transmission time stamps are transmitted in S2, the current local system time stamps are read first, then the obtained local system time stamps are written into the specific fields of the packet headers of the data packets by using a packet header expansion unit to form the data packets with time stamps, and finally the marked data packets are transmitted to a receiving end through the P2P network.
  6. 6. The method for detecting the time consuming of network packets in P2P network transmission in real time according to claim 1, wherein after receiving the data packet with the transmission time stamp in S3, analyzing the received data packet, and extracting the original transmission time stamp written by the transmitting end from the packet header.
  7. 7. The method for detecting the transmission time of the network packet in the P2P network according to claim 6, wherein the calculating the actual transmission time in S3 uses the following formula: Wherein the method comprises the steps of Time consuming for actual transmission; For receiving a timestamp; For sending a timestamp; Is a fixed time difference reference.
  8. 8. The method for detecting the transmission time consumption of the network packet in the P2P network according to claim 7, wherein the method is characterized in that the method is carried out after the actual transmission time consumption is calculated, the calculated actual transmission time consumption is firstly compared with a theoretical fixed time difference reference to obtain the current time drift amount or network delay deviation, then the deviation value obtained by continuous multiple measurement is processed by utilizing a sliding window algorithm or a weighted average filtering technology to eliminate abnormal noise generated by network jitter, so as to obtain a stable and reliable calibration coefficient, and then the equipment end or the APP end applies the calibration coefficient to the time sequence logic of a local clock or a subsequent data packet to realign the logic time from end to end.
  9. 9. The method for detecting time consuming transmission of network packets in a P2P network in real time according to claim 1, wherein when detecting that the network quality degradation reaches a threshold in S4, automatically re-triggering calculation of a time difference reference to update a new reference caused by clock drift or network environment change generated by long-time operation.
  10. 10. A system for detecting the time consumption of network packets in P2P network transmission in real time, which is suitable for the method for detecting the time consumption of network packets in P2P network transmission according to any one of claims 1 to 9, and is characterized by comprising: The time synchronization module comprises a plurality of interaction units, a fluctuation filtering unit and a time difference calculation unit, wherein the plurality of interaction units initiate a plurality of high-frequency time synchronization requests between an APP end and an equipment end, a plurality of groups of original interaction numbers containing round trip delay are collected, the fluctuation filtering unit calculates the average value and standard deviation of all round trip delay data, abnormal data groups are automatically identified and removed, the time difference calculation unit calculates the fixed time difference reference between the equipment at two ends by taking arithmetic average of clock difference values deduced by the time difference calculation unit based on the filtered effective data; The system comprises a time stamp adding module, a packet header expanding unit and a packet processing module, wherein the time stamp adding module comprises a sending time acquisition module and a packet header expanding module, the sending time acquisition unit acquires a system local time stamp of a current operating system, the packet header expanding unit encapsulates the data packet, and the acquired system local time stamp is written into a specific expanding field of a packet protocol header to form a data packet with a sending time mark; the time consumption calculation module comprises a receiving time acquisition unit, a time stamp extraction unit and a transmission time consumption calculation unit, wherein the receiving time acquisition unit records the current local receiving time stamp, the time stamp extraction unit analyzes the data packet header, the original sending time stamp written by the sending end is accurately extracted, the transmission time consumption calculation unit synthesizes the receiving time stamp, the sending time stamp and the fixed time difference reference provided by the time synchronization module, the calculation is carried out through a formula, the influence of the asynchronous clocks of the two ends of the system is counteracted, and the real unidirectional transmission time consumption of the data packet in the P2P network is calculated in real time.

Description

Method and system for detecting time consumption of network packet transmission in P2P network in real time Technical Field The invention relates to the technical field of communication, in particular to a method and a system for detecting time consumption of network packet transmission in a P2P network in real time. Background P2P is a decentralized network communication mode in which all data must be forwarded through a central server in a conventional client-to-server mode, whereas in P2P network transmissions, each node in the network is equally located, both as a client and as a server. The nodes can directly establish connection and exchange data without transit through a central server. Network packets are the basic unit of data transmission in a network. In both P2P and conventional networks, large files cannot be sent at once and must be cut into thousands of small packets. In P2P network communication, accurate measurement of packet transmission time is critical to optimizing performance, monitoring quality and fault diagnosis, but the prior art faces four challenges, namely, direct calculation time consumption is inaccurate due to asynchronous system clocks of a transmitting end and a receiving end, time synchronization accuracy is seriously affected by network jitter and delay fluctuation, a reliable reference is difficult to establish in single synchronization, an indirect calculation mode relying on round trip delay needs to additionally confirm packets, network burden is increased, real unidirectional transmission time consumption cannot be reflected in real time, and an effective anti-interference mechanism is lacking, so that measurement errors are large and reliability is low when a network is unstable, so that a technical scheme for detecting packet transmission time consumption in accurate, real-time and anti-interference mode is needed in a P2P environment. Disclosure of Invention The invention aims to provide a method and a system for detecting time consumption of network packet transmission in a P2P network in real time, which have the advantages of accuracy and reliability, and solve the problems that the calculation time consumption measurement is inaccurate and the network fluctuation interference is easy to occur when the network packet is transmitted in the existing P2P network communication. In order to achieve the above purpose, the invention provides a method for detecting time consumption of network packet transmission in a P2P network in real time, comprising the following steps: S1, establishing a high-precision time reference, executing multiple time interactions at an equipment end or an APP end, calculating round trip delay data of time, and determining a final fixed time difference reference; s2, transmitting and marking the data packet, and transmitting the data packet with the transmission time stamp by the equipment end or the APP end; S3, receiving and consuming time calculation, wherein the equipment end or the APP end receives the data packet with the sending time stamp, records the current receiving time stamp, and calculates the actual transmission consuming time according to the sending time stamp, the receiving time stamp and a fixed time difference reference; And S4, real-time monitoring is carried out, the transmission time-consuming data is monitored in real time, and the time difference reference is dynamically updated according to the monitored data. As a method for detecting time consumption of network packet transmission in P2P network in real time, the method is preferable, when executing time interaction for multiple times in S1, N times of network time synchronization requests are initiated between equipment ends or APP ends, time data of each interaction is recorded, and multiple groups of original time data are obtained. As a method for detecting time consumption of network packets transmitted in a P2P network in real time, the method is preferable, after a plurality of groups of original time data are obtained, an abnormal data group is identified and removed, the abnormal data group is identified through a difference method, the abnormal data is labeled, and the labeled abnormal data is replaced by a connecting line value of a front normal point and a rear normal point. When the round trip delay data of the calculated time is calculated in the step S1, the corresponding round trip delay is calculated for each synchronous request, the average value of all the N round trip delay data is calculated, the data group exceeding the effective interval is identified and removed, the effective interval is the numerical range of the average value plus the standard deviation, the interference caused by the severe fluctuation of the network is eliminated, the average value of the time difference corresponding to the rest effective data group is taken as the fixed time difference reference between the equipment end and the APP end. As a preferred method for de