CN105743729A - Method and device for time delay calculation - Google Patents

Method and device for time delay calculation Download PDF

Info

Publication number
CN105743729A
CN105743729A CN201410765859.1A CN201410765859A CN105743729A CN 105743729 A CN105743729 A CN 105743729A CN 201410765859 A CN201410765859 A CN 201410765859A CN 105743729 A CN105743729 A CN 105743729A
Authority
CN
China
Prior art keywords
message
time
network equipment
test value
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410765859.1A
Other languages
Chinese (zh)
Inventor
朱梁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201410765859.1A priority Critical patent/CN105743729A/en
Publication of CN105743729A publication Critical patent/CN105743729A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method and a device for time delay calculation. The method comprises steps that when a first message sent by the first network equipment is received, the first reception time of the first message is recorded; the first message is forwarded to the second network equipment; when a second message returned by the second network equipment is received, the second reception time of the second message is recorded; whether the second message is a response message of the first message is determined; if yes, the network time delay from the second network equipment to the time delay detection equipment is half of the time difference of the second reception time and the first reception time. Through the method, the calculation network time delay is more accurate compared with the prior art.

Description

A kind of time-delay calculation method and device
Technical field
The present invention relates to communication technical field, particularly relate to a kind of time-delay calculation method and device.
Background technology
Along with the complexity of internet environment is continuously increased, whether message transmission speed in a network is also in the increase of equal extent, it is desirable to have technology carrys out statistical measures more accurately.
Prior art is by obtaining terminal device at same TCP (TransmissionControlProtocol, transmission control protocol) connect in, the timestamp of in opposite direction two TCP message sent, then subtracts each other the two timestamp and obtains network delay.But the method can not shield terminal device and generate the time that TCP message uses, the network delay that the method calculates therefore is used to be inaccurate.
Summary of the invention
In view of this, the present invention provides a kind of time-delay calculation method and device to calculate inaccurate problem to solve network delay in prior art.
A kind of time-delay calculation method, described method is applied to time delay detection equipment, and described method includes:
When receiving the first message that first network equipment sends, record receives the first reception time of described first message;
Described first message is forwarded to second network equipment;
When receiving the second message that described second network equipment returns, record receives the second reception time of described second message;
Judge that whether described second message is the response message of described first message;
If so, then described second network equipment receives time and the described first half of time difference receiving the time to the network delay of described time delay detection equipment equal to described second.
Further, described first message includes message length value and the first test value;Described second message includes the second test value.
Further, described judge that whether described second message is the response message of described first message, including:
During when described second test value equal to described message length value and described first test value sum, then described second message is the response message of described first message.
Further, described first message is data message;Described second message is confirmation message.
Further, described first test value is the test serial number of described data message;Described second test value is the message confirmation number of described confirmation message.
Based on identical design, the present invention also provides for a kind of time-delay calculation device, and described device is applied to time delay detection equipment, and described device includes:
First record unit, for when receiving the first message that first network equipment sends, record receives the first reception time of described first message;
Message retransmission unit, for being forwarded to second network equipment by described first message;
Second record unit, for when receiving the second message that described second network equipment returns, record receives the second reception time of described second message;
Message judging unit, for judging that whether described second message is the response message of described first message;
Time-delay calculation unit, for when the response message that described second message is described first message, then described second network equipment is equal to the described second half receiving time and the described first time difference receiving the time to the network delay of described time delay detection equipment.
Further, described first message includes message length value and the first test value;Described second message includes the second test value.
Further, described message judging unit, specifically for during at described second test value equal to described message length value and described first test value sum, it is determined that described second message is the response message of described first message.
Further, described first message is data message;Described second message is confirmation message.
Further, described first test value is the test serial number of described data message;Described second test value is the message confirmation number of described confirmation message.
As can be seen here, the present invention can carry out computing network time delay by the confirmation message screening data message in TCP message corresponding, and owing to the generation time of described confirmation message is extremely short, the network delay therefore calculated by the present invention is more accurate relative to prior art.
Accompanying drawing explanation
Fig. 1 is to be a kind of networking logical structure schematic diagram in the embodiment of the present invention;
Fig. 2 is the process chart of a kind of time-delay calculation method provided by the invention;
Fig. 3 is a kind of message transmissions schematic diagram in the embodiment of the present invention;
Fig. 4 is the structural representation of a kind of time-delay calculation device in the embodiment of the present invention;
Fig. 5 is the structural representation of another kind of time-delay calculation device in the embodiment of the present invention.
Detailed description of the invention
Referring to Fig. 1, a kind of networking building-block of logic signal that the present embodiment provides.Wherein first network equipment and second network equipment carry out message transmissions by TCP connection.In order to test the network delay between first network equipment and second network equipment, time delay detection equipment is set between first network equipment and second network equipment.Traditional time-delay calculation method is the TCP message that the both direction by obtaining between first network equipment and second network equipment in same session is contrary, for instance the data message that the data message of first network equipment transmission and second network equipment are replied;Again the time of said two TCP message is subtracted each other, thus the network delay calculated between first network equipment and second network equipment.But the method can not shield one-port equipment and generate the time that TCP message uses, owing to the usual content of the data message in TCP message is bigger, therefore the generation time of its correspondence is relatively long, use the network delay that the method calculates to further comprises relatively long data message and generate the time, cause that result of calculation is inaccurate.
For solving the problems referred to above, the present invention provides a kind of time-delay calculation method and device, computing network time delay can be carried out by the confirmation message that the data message in screening TCP message is corresponding, owing to the generation time of described confirmation message is extremely short, the network delay therefore calculated by the present invention is more accurate relative to prior art.
Referring to Fig. 2, the process chart of a kind of time-delay calculation method that the present embodiment provides.Described time-delay calculation method is applied to prolong detection equipment in Fig. 1, and described method includes:
Step 201, when receiving the first message that first network equipment sends, record receives the first reception time of described first message;
In the present embodiment, described first network equipment and the mutual TCP message of second network equipment can through described time delay detection equipment.
When described time delay detection equipment receives the first message that described first network equipment sends, record this first message and arrive the first reception time of this equipment.For the ease of inquiry, the described first reception time can be added in the time sheet of this equipment by described time delay detection equipment in an alternate embodiment of the invention.This time sheet generally can include message information, for instance the five-tuple information of message, message serial number information and length value information etc..Described time delay detection equipment is by list item corresponding for the message information of described first message added in described the time sheet corresponding described first reception time.
Step 202, described first message is forwarded to second network equipment;
After the first reception time recording described first message, described time delay detection equipment can obtain the destination address information in the five-tuple information of described first message, this first message of transparent transmission.In the present embodiment, owing to there is session connection between described first network equipment and second network equipment, therefore by the five-tuple information of described first message, described time delay detection equipment can judge that the target device of this first message is described second network equipment, thus described first message can be forwarded to second network equipment by described time delay detection equipment.
Step 203, when receiving the second message that described second network equipment returns, record receives the second reception time of described second message;
When described time delay detection equipment receives the second message that described second network equipment returns, record this second message and arrive the second reception time of this equipment, and in list item corresponding to the described second reception time is added to described second message in described time sheet message information.
Step 204, judge that whether described second message is the response message of described first message;
Due in the session of described first network equipment and second network equipment, it will usually there is substantial amounts of TCP message mutual, in fact it could happen that described first network equipment sends multiple TCP message, and described second network equipment only returns the situation of a TCP message.Therefore, described time delay detection equipment is before computing network time delay, it is necessary to judge whether described second message is the response message that described first message is corresponding.
In optional embodiment of the present invention, described first message generally includes message length value and the first test value;Described second message generally includes the second test value.So time delay detection equipment specifically can pass through to judge that whether described second test value is equal to described message length value and described first test value sum, determines the response message that described second message is described first message.When described second test value is equal to described message length value and described first test value sum, then it is believed that the response message that described second message is described first message.
Step 205, if so, then described second network equipment receives time and the described first half of time difference receiving the time to the network delay of described time delay detection equipment equal to described second.
After determining the response message that described second message is described first message, described time delay detection equipment can extract described first reception time and the second reception time from the time sheet of this equipment, calculating described second network equipment network delay to described time delay detection equipment, described network delay receives the half of time and the described first time difference receiving the time equal to described second.
In the present embodiment, described first network equipment and second network equipment only represent the network equipment at described time delay detection equipment two ends, and the two position can exchange.Therefore, location swap when first network equipment and second network equipment, when namely being sent the first message by second network equipment, when being returned the second message by first network equipment, receive, with described first, the network delay that Time Calculation goes out above by the described second reception time, then for the first network equipment network delay to time delay detection equipment, therefore repeat no more.
In optional embodiment of the present invention, described first message can be the data message in TCP message;Described second message can be the confirmation message in TCP message.Further, when described first message is data message, described first test value in described first message can be the test serial number of described data message.When described second message is confirmation message, above-mentioned second test value in described second message can be the message confirmation number of described confirmation message.
As can be seen here, the present invention can carry out computing network time delay by the confirmation message screening data message in TCP message corresponding, and owing to the generation time of described confirmation message is extremely short, the network delay therefore calculated by the present invention is more accurate relative to prior art.
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described in detail.
Fig. 3 is a kind of message transmissions schematic diagram in the embodiment of the present invention, is provided with client in time delay detection equipment side, and opposite side is provided with server.Client and server carries out data transmission based on existing TCP connection.Time delay detection equipment is as follows according to the process of time-delay calculation method computing network time delay provided by the invention:
Client continuously transmits data message DATA1 and DATA2 by existing TCP connection to server;Wherein the test serial number seq of this DATA1 message is 1, and length value len is 200;The test serial number seq of this DATA2 message is 2, and length value len is 200.
When time delay detection equipment receives described DATA1 message, record the reception time T1 of described DATA1 message, and this message five-tuple information, test serial number seq, the information such as length value len, then the information of above-mentioned DATA1 message is converged into a time sheet item, add in the time sheet of self, then by described DATA1 message transmission to described server.In like manner, when time delay detection equipment receives described DATA2 message, record the reception time T2 of described DATA2 message, and this message five-tuple information, test serial number seq, the information such as length value len, then the information of above-mentioned DATA2 message is converged into a time sheet item, add in the time sheet of self, then by described DATA2 message transmission to described server.
Packet bigger for content sends owing to generally can be split into multiple DATA message by client, and after server receives DATA message, without each DATA message is replied confirmation message ACK message, have only to when receiving last DATA message of this packet, reply ACK message.Assume first message and last message of DATA1 message and DATA2 message respectively same packet.After so described server receives DATA2 message, replying ACK1 message to described client, wherein the message confirmation ack of this ACK1 message is 202.
When time delay detection equipment receives the ACK1 message that described server is replied, record the reception time T3 of described ACK1 message, and this information such as message five-tuple information, message confirmation ack, then the information of above-mentioned ACK1 message is converged into a time sheet item, add in the time sheet of self, then by described ACK1 message transmission to described client.
Having recorded message information and after the message reception time, described time delay detection equipment can obtain the data message belonging to same session and confirmation message from the time sheet of self.Owing to the message of same session has identical five-tuple information, therefore time delay detection equipment can find above-mentioned DATA1 message, DATA2 message and ACK1 message belong to same session according to the tuple information of record in time sheet.
Then time delay detection equipment further will from the above-mentioned message found, it is judged which data message is corresponding with described ACK1 message.Concrete determination methods is by judging which group message coincidence formula:
Ack=seq+len;
Bring the information of described DATA1 message, DATA2 message and ACK1 message into above-mentioned formula respectively between two, then known described ACK1 message is the confirmation message that DATA2 message is corresponding.Therefore time delay detection equipment can calculate the described server network delay to described time delay detection equipment according to the reception time that DATA2 message is corresponding with ACK1 message, is (T3-T2)/2.
In like manner, when server continuously transmits data message DATA3 and DATA4 by existing TCP connection to client;Wherein the test serial number seq of this DATA3 message is 3, and length value len is 100;The test serial number seq of this DATA4 message is 4, and length value len is 100.
When time delay detection equipment receives described DATA3 message, record the reception time T4 of described DATA3 message, and this message five-tuple information, test serial number seq, the information such as length value len, then the information of above-mentioned DATA3 message is converged into a time sheet item, add in the time sheet of self, then by described DATA3 message transmission to described client.In like manner, when time delay detection equipment receives described DATA4 message, record the reception time T5 of described DATA4 message, and this message five-tuple information, test serial number seq, the information such as length value len, then the information of above-mentioned DATA4 message is converged into a time sheet item, add in the time sheet of self, then by described DATA4 message transmission to described client.
Assume first message and last message of DATA3 message and DATA4 message respectively same packet.After so described client receives DATA4 message, replying ACK2 message to described server, wherein the message confirmation ack of this ACK2 message is 104.
When time delay detection equipment receives the ACK2 message that described client is replied, record the reception time T6 of described ACK2 message, and this information such as message five-tuple information, message confirmation ack, then the information of above-mentioned ACK2 message is converged into a time sheet item, add in the time sheet of self, then by described ACK2 message transmission to described server.
Time delay detection equipment can find above-mentioned DATA3 message, DATA4 message and ACK2 message according to the tuple information of record in time sheet and belong to same session.
Then time delay detection equipment passes through formula: ack=seq+len, determines whether that described ACK2 message is the confirmation message of which data message.
Bring the information of described DATA3 message, DATA4 message and ACK2 message into above-mentioned formula respectively between two, then known described ACK2 message is the confirmation message that DATA4 message is corresponding.Therefore time delay detection equipment can calculate the described client network delay to described time delay detection equipment according to the reception time that DATA4 message is corresponding with ACK2 message, is (T6-T5)/2.
As can be seen here, the present invention can carry out computing network time delay by the confirmation message screening data message in TCP message corresponding, and owing to the generation time of described confirmation message is extremely short, the network delay therefore calculated by the present invention is more accurate relative to prior art.
Based on identical design, the present invention also provides for a kind of time-delay calculation device, and described device can be realized by software, it is also possible to is realized by the mode of hardware or software and hardware combining.Implemented in software for example, the time-delay calculation device of the present invention, as the device on a logical meaning, is that computer program instructions corresponding in nonvolatile memory is read to run in internal memory and forms by the CPU by its place equipment.
Refer to Fig. 4 and Fig. 5, a kind of time-delay calculation device 400 provided in the embodiment of the present invention, described device is applied to time delay detection equipment, the basic running environment of described device includes CPU, nonvolatile memory, internal memory and other hardware, from logic level, described device 400 includes:
First record unit 401, for when receiving the first message that first network equipment sends, record receives the first reception time of described first message;
Message retransmission unit 402, for being forwarded to second network equipment by described first message;
Second record unit 403, for when receiving the second message that described second network equipment returns, record receives the second reception time of described second message;
Message judging unit 404, for judging that whether described second message is the response message of described first message;
Time-delay calculation unit 405, for when the response message that described second message is described first message, then described second network equipment is equal to the described second half receiving time and the described first time difference receiving the time to the network delay of described time delay detection equipment.
Further, described first message can include message length value and the first test value;Described second message can include the second test value.
Further, described message judging unit, specifically for during at described second test value equal to described message length value and described first test value sum, it is determined that described second message is the response message of described first message.
Further, described first message can be data message;Described second message can be confirmation message.
Further, when described first message is data message;When described second message is confirmation message, described first test value can be the test serial number of described data message;Described second test value can be the message confirmation number of described confirmation message.
As can be seen here, the present invention can carry out computing network time delay by the confirmation message screening data message in TCP message corresponding, and owing to the generation time of described confirmation message is extremely short, the network delay therefore calculated by the present invention is more accurate relative to prior art.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all within the spirit and principles in the present invention, any amendment of making, equivalent replacement, improvement etc., should be included within the scope of protection of the invention.

Claims (10)

1. a time-delay calculation method, it is characterised in that described method is applied to time delay detection equipment, and described method includes:
When receiving the first message that first network equipment sends, record receives the first reception time of described first message;
Described first message is forwarded to second network equipment;
When receiving the second message that described second network equipment returns, record receives the second reception time of described second message;
Judge that whether described second message is the response message of described first message;
If so, then described second network equipment receives time and the described first half of time difference receiving the time to the network delay of described time delay detection equipment equal to described second.
2. the method for claim 1, it is characterised in that
Described first message includes message length value and the first test value;
Described second message includes the second test value.
3. method as claimed in claim 2, it is characterised in that described judge that whether described second message is the response message of described first message, including:
During when described second test value equal to described message length value and described first test value sum, then described second message is the response message of described first message.
4. method as claimed in claim 2, it is characterised in that
Described first message is data message;
Described second message is confirmation message.
5. method as claimed in claim 4, it is characterised in that
Described first test value is the test serial number of described data message;
Described second test value is the message confirmation number of described confirmation message.
6. a time-delay calculation device, it is characterised in that described device is applied to time delay detection equipment, and described device includes:
First record unit, for when receiving the first message that first network equipment sends, record receives the first reception time of described first message;
Message retransmission unit, for being forwarded to second network equipment by described first message;
Second record unit, for when receiving the second message that described second network equipment returns, record receives the second reception time of described second message;
Message judging unit, for judging that whether described second message is the response message of described first message;
Time-delay calculation unit, for when the response message that described second message is described first message, then described second network equipment is equal to the described second half receiving time and the described first time difference receiving the time to the network delay of described time delay detection equipment.
7. device as claimed in claim 6, it is characterised in that
Described first message includes message length value and the first test value;
Described second message includes the second test value.
8. device as claimed in claim 7, it is characterised in that described message judging unit, specifically for during at described second test value equal to described message length value and described first test value sum, it is determined that described second message is the response message of described first message.
9. device as claimed in claim 7, it is characterised in that
Described first message is data message;
Described second message is confirmation message.
10. device as claimed in claim 9, it is characterised in that
Described first test value is the test serial number of described data message;
Described second test value is the message confirmation number of described confirmation message.
CN201410765859.1A 2014-12-12 2014-12-12 Method and device for time delay calculation Pending CN105743729A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410765859.1A CN105743729A (en) 2014-12-12 2014-12-12 Method and device for time delay calculation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410765859.1A CN105743729A (en) 2014-12-12 2014-12-12 Method and device for time delay calculation

Publications (1)

Publication Number Publication Date
CN105743729A true CN105743729A (en) 2016-07-06

Family

ID=56241361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410765859.1A Pending CN105743729A (en) 2014-12-12 2014-12-12 Method and device for time delay calculation

Country Status (1)

Country Link
CN (1) CN105743729A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108011778A (en) * 2017-11-30 2018-05-08 北京润科通用技术有限公司 A kind of method and device for obtaining message transmissions time delay
WO2021254056A1 (en) * 2020-06-20 2021-12-23 华为技术有限公司 Delay measurement method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1933429A (en) * 2005-09-12 2007-03-21 华为技术有限公司 Time delay characteristic measuring method in data communication network
CN102035692A (en) * 2009-09-30 2011-04-27 中兴通讯股份有限公司 Method and device for detecting quality of link
CN103297282A (en) * 2012-02-22 2013-09-11 株式会社Ntt都科摩 Network delay measuring device and method
CN103607267A (en) * 2013-07-23 2014-02-26 王健 End-to-end transmission delay carrying measurement method of data network message
CN103888306A (en) * 2012-12-19 2014-06-25 阿里巴巴集团控股有限公司 Message forwarding system performance test method and performance test device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1933429A (en) * 2005-09-12 2007-03-21 华为技术有限公司 Time delay characteristic measuring method in data communication network
CN102035692A (en) * 2009-09-30 2011-04-27 中兴通讯股份有限公司 Method and device for detecting quality of link
CN103297282A (en) * 2012-02-22 2013-09-11 株式会社Ntt都科摩 Network delay measuring device and method
CN103888306A (en) * 2012-12-19 2014-06-25 阿里巴巴集团控股有限公司 Message forwarding system performance test method and performance test device
CN103607267A (en) * 2013-07-23 2014-02-26 王健 End-to-end transmission delay carrying measurement method of data network message

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108011778A (en) * 2017-11-30 2018-05-08 北京润科通用技术有限公司 A kind of method and device for obtaining message transmissions time delay
CN108011778B (en) * 2017-11-30 2020-08-04 北京润科通用技术有限公司 Method and device for acquiring message transmission delay time
WO2021254056A1 (en) * 2020-06-20 2021-12-23 华为技术有限公司 Delay measurement method and device

Similar Documents

Publication Publication Date Title
CN112437141B (en) Method for establishing P2P direct connection by nodes in auxiliary block chain network
US9697528B2 (en) Tracking interactions with forwarded links by evaluating similarity of forwarded links and evaluating a chain of forwarding
CN101926154B (en) Method for measuring frame loss, system for measuring frame loss, and device for measuring frame loss
CN107624233B (en) VPN transmission tunnel scheduling method and device and VPN client server
EP2597828B1 (en) Dynamic adaptations for network delays during complex event processing
CN112787877B (en) Network delay detection method and related equipment
CN104901851B (en) A kind of method and system of detection network quality
US20190068502A1 (en) Information processing apparatus, method and non-transitory computer-readable storage medium
CN104144223B (en) A kind of data capture method and device
US20150249589A1 (en) Method and apparatus for determining automatic scanning action
WO2018077177A1 (en) Positioning method and positioning apparatus
CN104618922B (en) Measurement result matching process and device in a kind of RTT measurement and positionings system
CN105743729A (en) Method and device for time delay calculation
TW201507398A (en) Reliability of multi-state information network evaluation method and system thereof
US20150023189A1 (en) Packet analysis device and packet analyzing method
CN105591962A (en) Link load balancing detection method and device
CN110740078B (en) Proxy monitoring method of server and related products
CN105812204B (en) A kind of recurrence name server online recognition method based on Connected degree estimation
CN110784337A (en) Cloud service quality monitoring method and related product
US8289868B2 (en) Network device and method of measuring upstream bandwidth employed thereby
CN103401813B (en) A kind of asymmetric delay compensation method and switch
CN104468569A (en) Integrity detection method and device of distributed data
US9444729B2 (en) Fast application recognition system and fast application processing method
CN105591836A (en) Data flow detection method and device
CN106961365B (en) Network delay measuring method based on TCP protocol

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building

Applicant after: Hangzhou Dipu Polytron Technologies Inc

Address before: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building

Applicant before: Hangzhou Dipu Technology Co., Ltd.

CB02 Change of applicant information
RJ01 Rejection of invention patent application after publication

Application publication date: 20160706

RJ01 Rejection of invention patent application after publication