WO2012100698A1 - Method, device, and system for transmitting precision clock synchronization protocol message - Google Patents

Method, device, and system for transmitting precision clock synchronization protocol message Download PDF

Info

Publication number
WO2012100698A1
WO2012100698A1 PCT/CN2012/070493 CN2012070493W WO2012100698A1 WO 2012100698 A1 WO2012100698 A1 WO 2012100698A1 CN 2012070493 W CN2012070493 W CN 2012070493W WO 2012100698 A1 WO2012100698 A1 WO 2012100698A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
address
port
event message
server device
Prior art date
Application number
PCT/CN2012/070493
Other languages
French (fr)
Chinese (zh)
Inventor
柴斌
吕欣岩
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2012100698A1 publication Critical patent/WO2012100698A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2514Translation of Internet protocol [IP] addresses between local and global IP addresses

Definitions

  • the present invention relates to the field of communications, and in particular, to a method, device, and system for transmitting an accurate clock synchronization protocol message. Background technique
  • IEEE 1588 is Ion Clock Synchronization Protocol for Networked Measurement and Control Systems, accurate clock synchronization protocol for network measurement and control systems
  • IEEE 1588 Ion Clock Synchronization Protocol for Networked Measurement and Control Systems, accurate clock synchronization protocol for network measurement and control systems
  • the precise clock synchronization protocol message is divided into two types: general message (Genera l Mes sages) and event message (Event Mes sages), and different types of messages use different ports.
  • Pro toco l ver si on 4 Internet Protocol version 4
  • the server device When transmitting in the network, before the server device sends an event message to the client device, it needs to determine the IP address and port number used by the client device event message, and then according to the event. The IP address and port number used by the message send an event message to the client device.
  • NAT Network Addres s Translating
  • the prior art has at least the following disadvantages: As the number of computers continues to increase, IPv4 address resources cannot meet the needs of network users, and thus NAT (Network Addres s Translating) Conversion) is widely used in various types of IPv4 networks. Since the event message of the client device uses the port through the NAT network, its IP address and port number will be mapped to different public IP and port numbers, resulting in the server device. When the event message is sent to the client device, the IP address and port number of the event message of the client device are not known. Therefore, the transmission mode of the existing accurate clock synchronization protocol message has certain limitations in the NAT network. Sex. Summary of the invention
  • a method for transmitting an accurate clock synchronization protocol message includes: And sending, by the event message, the probe request message carrying the random number to the server device by using the port; receiving the probe response message returned by the server device by using the event message, where the probe response message carries the random number and the server device detects Address and port number corresponding to the probe request message;
  • the event message is notified to the server device by using the address and port number of the network address translated by the port, so that the server device initiates an event according to the address and port number after the network address translation. Message.
  • a client device comprising:
  • a sending module configured to send, by using an event message, a probe request message carrying a random number to the server device;
  • a receiving module configured to receive a probe response message returned by the server device by using the event message, where the probe response message carries a random number and an address and a port number corresponding to the probe request message detected by the server device;
  • a determining module configured to determine, according to a random number, an address, and a port number carried in the probe response message received by the receiving module, an address and a port number of the event message using a network address translated by the port;
  • a notification module configured to notify the server device that the event message determined by the determining module uses a network address translated address and a port number in the unicast negotiation process, so that the server device is configured according to the The address and port number after the network address translation initiates an event message.
  • a server device is also provided, the server device comprising:
  • a receiving module configured to receive a probe request message that carries a random number sent by the client device by using an event message
  • a returning module configured to return, by using the event message, a probe response message to the client device, where the probe response message carries a random number and an address and a port corresponding to the probe request message detected by the server device number;
  • an obtaining module configured to obtain, during the unicast negotiation process, the event message notified by the client device, using an address and a port number converted by the network address of the port;
  • a sending module configured to initiate an event message according to the address and port number converted by the network address obtained by the acquiring module.
  • a system for transmitting an accurate clock synchronization protocol message is also provided, the system comprising: a client device and a server device;
  • the client device is the client device
  • the server device is the server device.
  • the client device After the client device determines that the event message uses the address and port number of the port after the network address translation, it notifies the server device, so that the server device initiates an event message accordingly, thereby realizing an accurate clock synchronization protocol message in the NAT network. transmission.
  • FIG. 1 is a flowchart of a method for transmitting an accurate clock synchronization protocol message according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for transmitting an accurate clock synchronization protocol message according to Embodiment 2 of the present invention
  • FIG. 4 is a schematic structural diagram of a server device according to Embodiment 4 of the present invention.
  • FIG. 5 is a schematic structural diagram of a system for transmitting an accurate clock synchronization protocol message according to Embodiment 5 of the present invention. detailed description
  • this embodiment provides a method for transmitting an accurate clock synchronization protocol message.
  • the method is as follows:
  • 1 02 The receiving server device uses the probe response message returned by the port through the event message, where the probe response message carries the random number and the address and port number corresponding to the probe request message detected by the server device; 1 03: Determine, according to the random number, address, and port number carried in the probe response message, the address and port number of the event message using the network address translated by the port;
  • the event message is notified to the server device by the address and port number of the port after the network address translation, so that the server device initiates an event message according to the address and port number converted by the network address.
  • the address and the port number of the event message using the network address translation of the event message are determined according to the random number, the address, and the port number carried in the probe response message, and specifically include:
  • the address and port number carried in the probe response message are determined as the address and port number of the event message using the network address translation of the port.
  • the event message is notified to the server device by using the address and port number of the port after the network address translation, including:
  • the event message unicast negotiation request is sent to the server device through the general message using the port.
  • the event message unicast negotiation request carries the event message using the address and port number of the port after the network address translation, so that the server device obtains the unicast negotiation request according to the event message.
  • the event message uses the address and port number of the port after the network address translation.
  • the event message unicast negotiation request uses the address and port number of the port after the network address translation by using the extended cell carrying event message.
  • the method provided by the embodiment after the client device determines that the event message uses the address and port number of the port after the network address translation, notifies the server device of the event, so that the server device initiates an event message accordingly, thereby realizing an accurate clock.
  • the synchronization protocol message is transmitted in the NAT network.
  • This embodiment provides a method for transmitting an accurate clock synchronization protocol message.
  • the method uses the customized probe message to enable the client device to know whether a NAT exists in the network, and learns the event.
  • the message uses the NAT-transformed address and port number, it sends it to the server device, so that the server device initiates an event message accordingly.
  • the specific detection message is not limited in this embodiment.
  • the handshake request message and the handshake response message are used as an example for description. Referring to FIG. 2, the process of the method provided in this embodiment is specifically as follows: 201: The client device sends a handshake request message carrying a random number (Handshake.Req) to the server device by using an event message.
  • the event message uses port 319 of the UDP (User Datagram Protocol), and the general message uses port 320 of UDP. Therefore, in this step, the client device sends the port 319 to the server device.
  • a handshake request message carrying a random number.
  • the handshake request message carries a random number, and like other accurate clock synchronization protocol messages, the handshake request message also needs to carry the source IP address, the source port number of the handshake request message, and the handshake request message to be sent to. Destination IP address and destination port number.
  • the source IP address carried in the handshake request message is the private network IP address of the client device
  • the source port number is the port number 319 of the event message using the port
  • the destination IP address is the IP address of the server device.
  • the destination port number is also 319.
  • the role of the handshake request message is used to maintain the channel between the client device and the server device in addition to the channel between the client and the server in the NAT subnet.
  • the client device receives a handshake response message (Handshake.Resp) returned by the server using the event message, where the handshake response message carries a random number and a source IP address and a port number of the handshake request message detected by the server device.
  • a handshake response message (Handshake.Resp) returned by the server using the event message, where the handshake response message carries a random number and a source IP address and a port number of the handshake request message detected by the server device.
  • the source IP address, the source port number, and the destination IP address and destination port number to which the handshake response message is to be sent are also required to be carried in the handshake response message.
  • the source IP address carried in the handshake response message is the IP address of the server device, the source port number is 319, and the destination IP address is the address of the handshake request message detected by the server device, and the destination port number is the server device.
  • the port number of the detected handshake request message is the address and port number of the handshake request message detected by the server device are different from the address and port number of the handshake request message sent by the client device, the NAT exists between the client device and the server device. Therefore, the client device according to the handshake
  • the random number, address, and port number carried in the response message can be used to know whether NAT exists in the network.
  • the client device first determines whether the random number carried in the handshake response message is consistent with the random number carried in the handshake request message sent by the client, and if the agreement is consistent, the handshake response message is sent to the handshake request message sent by the client device. Corresponding response message. On the basis of this, the client device further compares the address and port number carried in the handshake response message with the address and port number when the probe request message is sent. If they are consistent, it is determined that there is no NAT in the network. Indicates that there is a NAT in the network, and also indicates the address and port of the handshake request message sent by the client device.
  • the number is changed by the network address, and the address and port number of the handshake request message detected by the server device is the translated address and port number, so the address and port number carried in the handshake response message can be determined as an event message. Use the address and port number of the port after the network address translation.
  • the client device After the client device learns that the event message uses the port to be network address translated, in order to enable the server device to send the event message normally, the client device may use the address of the port through the network address translation in the unicast negotiation process. The port number is notified to the server device. For details, see the subsequent steps.
  • the client device sends an Announce message unicast negotiation request to the server device, where the Announce message unicast negotiation request can be REQUEST-UNICAST-TRANSMI SSION ( Ann ); specifically, the client device can pass through port 319 ( Event message using port) send this
  • the Announce message unicast negotiation request may also send the Announce message unicast negotiation request through port 320 (general message use port). This embodiment does not limit the port used by the client to send the Announce message unicast negotiation request. Regardless of which port is used for sending, the Announce message unicast negotiation request also carries the source IP address (the private IP address of the client device), the source port number (320 or 319), and the destination IP address (the IP address of the server device). And the destination port number (320 or 319).
  • the client device receives an Announce message unicast negotiation response returned by the server device, where the Announce message unicast negotiation response may be GRANT_UNICAST_TRANSMISS ION ( Ann );
  • the Announce message unicast negotiation response returned by the server device also carries the address and port number of the Announce message unicast negotiation request detected by the server device, and if there is NAT, the Announce message detected by the server device The address and port number of the unicast negotiation request are inconsistent with the address and port number of the Announce message unicast negotiation request sent by the client device.
  • the client device receives an Announce message unicast by the server device.
  • the Announce message carries information such as an optimal clock priority, a time level, and a time precision, so that the client device can perform clock source selection according to the information carried in the received Announce message.
  • the client device sends a Sync (Synchronize) message unicast negotiation request to the server device by using a general message using a port, and the Sync message unicast negotiation request may be REQUEST_UNICAST_TRANSMISSION (Sync);
  • the client device sends a Sync message unicast negotiation request to the server device to request the server device to unicast the Sync message, to generate and interact time information according to the Sync message, and to synchronize the time.
  • the server device needs to use the port through the event message. (Port 319) is initiated. If there is a NAT in the network, the server does not determine in advance that the event message uses the address and port number of the port after the network address translation. In this regard, the client device learns that the event message uses the port in step 202. After the address and port number of the network address translation, the device can be notified to the server device during the unicast negotiation interaction.
  • the specific notification mode is not limited.
  • the address and port number of the event message using the network address translation port are used as an example in the Sync message unicast negotiation request.
  • the Sync message may be used in the Sync message.
  • the extended cell ORGANIZATION_EXTENSION, and the extended cell carries the event message using the address and port number cell of the port after the network address translation.
  • the client device receives a Sync message unicast negotiation response returned by the server device, where the Sync message unicast negotiation response may be GRANT_UNICAST_TRANSMISS ION (Sync);
  • the Sync message unicast negotiation response returned by the server device also carries the source IP address (the private IP address of the server device), the source port number (319), and the destination IP address (the IP address of the Sync message unicast negotiation request). Address) and destination port number (319).
  • the client device receives a Sync message that the server device uses the port unicast through the event message. Specifically, before the server device uses the port unicast Sync message by using the event message, the client device has notified the server device of the event message using the port address and port number converted by the network address in the Sync message unicast negotiation process. Therefore, when the server device uses the port unicast Sync message through the event message, the destination IP address and port number carried by the server device are the address and port number converted by the network address, so the Sync message can be accurately sent to the client device. The transmission of Sync messages in the NAT network is implemented.
  • step 206 the event message determined by the client device is notified to the server device by using the address and port number of the port after the network address translation. Therefore, the foregoing steps 201 and 202 may be performed in the above order. Executing before step 203, it may also be performed after step 205 and before step 206. The implementation is performed before the step 203 to keep the same with the existing protocol, and the aging of the NS is not limited.
  • Embodiment 3 The present embodiment provides a client device, which is used to perform the method steps performed by the client device in the first embodiment and the second embodiment. Referring to FIG. 3, the client device includes:
  • the sending module 301 is configured to send, by using an event message, a probe request message carrying a random number to the server device by using the port;
  • the receiving module 302 is configured to receive a probe response message returned by the server device by using an event message, where the probe response message carries a random number and an address and a port number corresponding to the probe request message detected by the server device;
  • the determining module 30 is configured to determine, according to the random number, address, and port number carried in the probe response message received by the receiving module 302, the address and port number of the event message using the network address translated by the port; the notification module 304 is configured to perform unicast During the negotiation, the event message determined by the module 303 is notified to the server device by using the address and port number of the port after the network address translation, so that the server device initiates an event message according to the address and port number converted by the network address.
  • the determining module 303 is specifically configured to: when the random number carried in the probe response message is consistent with the random number carried in the probe request message, compare the address and the port number carried in the probe response message with the sending of the probe request message. If the address and port number are the same, if the number is inconsistent, the address and port number carried in the probe response message are determined as the address and port number of the event message using the network address translation port.
  • the notification module 304 is configured to send an event message unicast negotiation request to the server device by using the general message using the port, and the event message unicast negotiation request carries the address and port number of the event message using the network address translation port, so that the server device According to the event message unicast negotiation request, the event message is obtained by using the address and port number of the port after the network address translation.
  • the client device provided in this embodiment notifies the server device by using the address and port number after the network address is translated by using the port, so that the server device initiates an event message according to the event, thereby realizing accurate clock synchronization.
  • the embodiment of the present invention provides a server device, which is used to perform the method steps performed by the server device in the first embodiment and the second embodiment.
  • the server device includes: a receiving module 401, configured to receive a client.
  • the end device sends a probe request message carrying a random number sent by the port through the event message;
  • the returning module 402 is configured to return a probe response to the client device by using the event message using the port.
  • the probe response message carries the random number and the address and port number corresponding to the probe request message detected by the server device;
  • the obtaining module 40 is configured to obtain an event message notified by the client device during the unicast negotiation process, using an address and a port number of the port after the network address translation;
  • the sending module 404 is configured to initiate an event message according to the address and port number converted by the network address obtained by the obtaining module 403.
  • the obtaining module 403 is specifically configured to receive an event message unicast negotiation request sent by the client device through the general message using the port, and the event message unicast negotiation request carries the address and port number of the event message using the port after the network address translation. According to the event message unicast negotiation request, the event message is obtained by using the address and port number of the port after the network address translation.
  • the server device provided by the embodiment sends an event message according to the address and the port number converted by the network address after the event message notified by the client device is obtained, thereby implementing an accurate clock synchronization protocol message in the NAT network. Transmission.
  • Embodiment 5
  • This embodiment provides a system for transmitting an accurate clock synchronization protocol message.
  • the system includes: a client device 501 and a server device 502;
  • the client device 501 is the client device provided in the foregoing Embodiment 3;
  • the server device 502 is the server device provided in the above fourth embodiment.
  • the system provided by the embodiment, after the client device determines that the event message uses the address and port number of the port after the network address translation, notifies the server device to enable the server device to initiate an event message according to the event, thereby implementing the event message.
  • the transmission of precise clock synchronization protocol messages in a NAT network it should be noted that, when the client device and the server device provided by the foregoing embodiments transmit the accurate clock synchronization protocol message, only the division of the foregoing functional modules is illustrated.
  • the functional modules may be implemented in hardware or in software.
  • the above functional modules may be implemented in combination or further split into sub-modules.
  • the above function assignment can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the client device, the server device, the system for transmitting the accurate clock synchronization protocol message, and the method for transmitting the accurate clock synchronization protocol message are in the same concept, and the specific implementation process is described in the method embodiment. Narration.
  • the serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments. All or part of the steps in the embodiment of the present invention may be implemented by using software, and the corresponding software program may be stored in a readable storage medium, such as an optical disk or a hard disk.

Abstract

Disclosed are a method, a device, and a system for transmitting a precision clock synchronization protocol message, which belong to the field of communications. The method comprises: sending a probe request message carrying a random number to a server device through an event message port; receiving a probe response message returned by the server device through the event message port; determining, according to a random number, an address, and a port number carried in the probe response message, an address and a port number of the event message port after network address translation; and notifying the server device of the address and the port number of the event message port after the network address translation in a unicast negotiation process. In the present invention, a client device notifies the server device of the determined address and port number of the event message port after the network address translation, so that the server device initiates an event message accordingly, thereby implementing the transmission of the precision clock synchronization protocol message in an NAT network.

Description

传输精确时钟同步协议消息的方法、 设备及系统 技术领域  Method, device and system for transmitting precise clock synchronization protocol message
本发明涉及通信领域, 特别涉及一种传输精确时钟同步协议消息的方法、 设备及系统。 背景技术  The present invention relates to the field of communications, and in particular, to a method, device, and system for transmitting an accurate clock synchronization protocol message. Background technique
在通信网络中, 许多业务的正常运行都要求网络时钟同步, IEEE 1588 ( Prec i s ion Clock Synchronizat ion Protoco l for Networked Measurement and Control Sys tems , 网络测量和控制系统的精确时钟同步协议)作为一种时间 同步协议标准, 能够满足更高精度的时间同步要求, 在通信网络中常常需要通 过传输精确时钟同步协议消息来实现网络时钟同步。 其中, 精确时钟同步协议 消息分为一般消息 ( Genera l Mes sages )及事件消息 ( Event Mes sages ) 两种 类型, 不同类型的消息使用不同的端口。  In a communication network, the normal operation of many services requires network clock synchronization, IEEE 1588 (Prec is Ion Clock Synchronization Protocol for Networked Measurement and Control Systems, accurate clock synchronization protocol for network measurement and control systems) as a time Synchronous protocol standards can meet higher precision time synchronization requirements. In communication networks, it is often necessary to implement network clock synchronization by transmitting accurate clock synchronization protocol messages. Among them, the precise clock synchronization protocol message is divided into two types: general message (Genera l Mes sages) and event message (Event Mes sages), and different types of messages use different ports.
现有单播网络中, 当精确时钟同步协议消息承载在 IPv4 ( Interne t In existing unicast networks, when the precise clock synchronization protocol message is carried in IPv4 (Interne t
Pro toco l ver s i on 4 , 网际协议版本 4 ) 网络中传输时, 服务器设备向客户端 设备发送事件消息之前, 需要先确定客户端设备事件消息使用的 IP地址及端口 号,之后再根据该事件消息使用的 IP地址及端口号向客户端设备发送事件消息。 Pro toco l ver si on 4 , Internet Protocol version 4) When transmitting in the network, before the server device sends an event message to the client device, it needs to determine the IP address and port number used by the client device event message, and then according to the event. The IP address and port number used by the message send an event message to the client device.
在实现本发明的过程中, 发明人发现现有技术至少存在以下缺点: 随着计算机数量的不断猛增, IPv4地址资源无法满足网络用户的需求, 因 而 NAT ( Network Addres s Trans lat ion,网络地址转换)被广泛应用于各种类型 的 IPv4网络中, 由于客户端设备的事件消息使用端口经过 NAT网络后, 其 IP 地址及端口号将被映射为不同的公网 IP和端口号, 致使服务器设备在先向客户 端设备发送事件消息时, 无法获知客户端设备的事件消息使用端口经 NAT后的 IP地址和端口号, 因而现有精确时钟同步协议消息的传输方式在 NAT网络中具 有一定的局限性。 发明内容  In the process of implementing the present invention, the inventors have found that the prior art has at least the following disadvantages: As the number of computers continues to increase, IPv4 address resources cannot meet the needs of network users, and thus NAT (Network Addres s Translating) Conversion) is widely used in various types of IPv4 networks. Since the event message of the client device uses the port through the NAT network, its IP address and port number will be mapped to different public IP and port numbers, resulting in the server device. When the event message is sent to the client device, the IP address and port number of the event message of the client device are not known. Therefore, the transmission mode of the existing accurate clock synchronization protocol message has certain limitations in the NAT network. Sex. Summary of the invention
为了实现在 NAT网络中传输精确时钟同步协议消息, 本发明实施例提供了 一种传输精确时钟同步协议消息的方法、 设备及系统。 所述技术方案如下: 一方面, 提供了一种传输精确时钟同步协议消息的方法, 所述方法包括: 通过事件消息使用端口向服务器设备发送携带随机数的探测请求消息; 接收所述服务器设备通过所述事件消息使用端口返回的探测响应消息, 该 探测响应消息中携带了随机数及所述服务器设备检测到的所述探测请求消息对 应的地址及端口号; In order to implement the transmission of the accurate clock synchronization protocol message in the NAT network, the embodiment of the invention provides a method, device and system for transmitting an accurate clock synchronization protocol message. The technical solution is as follows: In one aspect, a method for transmitting an accurate clock synchronization protocol message is provided, where the method includes: And sending, by the event message, the probe request message carrying the random number to the server device by using the port; receiving the probe response message returned by the server device by using the event message, where the probe response message carries the random number and the server device detects Address and port number corresponding to the probe request message;
根据所述探测响应消息中携带的随机数、 地址及端口号确定所述事件消息 使用端口经网络地址转换后的地址及端口号;  Determining, according to the random number, address, and port number carried in the probe response message, the address and port number of the event message using the network address translation of the port;
在单播协商过程中将所述事件消息使用端口经网络地址转换后的地址及端 口号通知给所述服务器设备, 使所述服务器设备根据所述经网络地址转换后的 地址及端口号发起事件消息。  In the unicast negotiation process, the event message is notified to the server device by using the address and port number of the network address translated by the port, so that the server device initiates an event according to the address and port number after the network address translation. Message.
另一方面, 提供了一种客户端设备, 所述客户端设备包括:  In another aspect, a client device is provided, the client device comprising:
发送模块, 用于通过事件消息使用端口向服务器设备发送携带随机数的探 测请求消息;  a sending module, configured to send, by using an event message, a probe request message carrying a random number to the server device;
接收模块, 用于接收所述服务器设备通过所述事件消息使用端口返回的探 测响应消息, 该探测响应消息中携带了随机数及服务器设备检测到的所述探测 请求消息对应的地址及端口号;  a receiving module, configured to receive a probe response message returned by the server device by using the event message, where the probe response message carries a random number and an address and a port number corresponding to the probe request message detected by the server device;
确定模块, 用于根据所述接收模块接收到的探测响应消息中携带的随机 数、 地址及端口号确定所述事件消息使用端口经网络地址转换后的地址及端口 号;  a determining module, configured to determine, according to a random number, an address, and a port number carried in the probe response message received by the receiving module, an address and a port number of the event message using a network address translated by the port;
通知模块, 用于在单播协商过程中将所述确定模块确定的所述事件消息使 用端口经网络地址转换后的地址及端口号通知给所述服务器设备, 使所述服务 器设备根据所述经网络地址转换后的地址及端口号发起事件消息。  a notification module, configured to notify the server device that the event message determined by the determining module uses a network address translated address and a port number in the unicast negotiation process, so that the server device is configured according to the The address and port number after the network address translation initiates an event message.
还提供了一种服务器设备, 所述服务器设备包括:  A server device is also provided, the server device comprising:
接收模块, 用于接收客户端设备通过事件消息使用端口发送的携带随机数 的探测请求消息;  a receiving module, configured to receive a probe request message that carries a random number sent by the client device by using an event message;
返回模块, 用于通过所述事件消息使用端口向所述客户端设备返回探测响 应消息, 该探测响应消息中携带了随机数及所述服务器设备检测到的所述探测 请求消息对应的地址及端口号;  a returning module, configured to return, by using the event message, a probe response message to the client device, where the probe response message carries a random number and an address and a port corresponding to the probe request message detected by the server device number;
获取模块, 用于在单播协商过程中获取所述客户端设备通知的所述事件消 息使用端口经网络地址转换后的地址及端口号;  And an obtaining module, configured to obtain, during the unicast negotiation process, the event message notified by the client device, using an address and a port number converted by the network address of the port;
发送模块, 用于根据所述获取模块获取到的经网络地址转换后的地址及端 口号发起事件消息。 还提供了一种传输精确时钟同步协议消息的系统, 所述系统包括: 客户端 设备和服务器设备; And a sending module, configured to initiate an event message according to the address and port number converted by the network address obtained by the acquiring module. A system for transmitting an accurate clock synchronization protocol message is also provided, the system comprising: a client device and a server device;
所述客户端设备如上述客户端设备; 所述服务器设备如上述服务器设备。 本发明实施例提供的技术方案的有益效果是:  The client device is the client device, and the server device is the server device. The beneficial effects of the technical solutions provided by the embodiments of the present invention are:
通过在客户端设备确定事件消息使用端口经网络地址转换后的地址及端口 号后, 将其通知给服务器设备, 使服务器设备据此发起事件消息, 从而实现精 确时钟同步协议消息在 NAT网络中的传输。 附图说明  After the client device determines that the event message uses the address and port number of the port after the network address translation, it notifies the server device, so that the server device initiates an event message accordingly, thereby realizing an accurate clock synchronization protocol message in the NAT network. transmission. DRAWINGS
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所 需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明 的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in view of the drawings.
图 1是本发明实施例一提供的传输精确时钟同步协议消息的方法流程图; 图 2是本发明实施例二提供的传输精确时钟同步协议消息的方法流程图; 图 3是本发明实施例三提供的客户端设备结构示意图;  1 is a flowchart of a method for transmitting an accurate clock synchronization protocol message according to Embodiment 1 of the present invention; FIG. 2 is a flowchart of a method for transmitting an accurate clock synchronization protocol message according to Embodiment 2 of the present invention; A schematic diagram of the structure of the client device provided;
图 4是本发明实施例四提供的服务器设备结构示意图;  4 is a schematic structural diagram of a server device according to Embodiment 4 of the present invention;
图 5是本发明实施例五提供的传输精确时钟同步协议消息的系统结构示意 图。 具体实施方式  FIG. 5 is a schematic structural diagram of a system for transmitting an accurate clock synchronization protocol message according to Embodiment 5 of the present invention. detailed description
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明 实施方式作进一步地详细描述。  The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
实施例一  Embodiment 1
参见图 1, 本实施例提供了一种传输精确时钟同步协议消息的方法, 该方法 流程如下:  Referring to FIG. 1, this embodiment provides a method for transmitting an accurate clock synchronization protocol message. The method is as follows:
1 01: 通过事件消息使用端口向服务器设备发送携带随机数的探测请求消 息;  1 01: Sending, by using an event message, a probe request message carrying a random number to a server device by using a port;
1 02: 接收服务器设备通过事件消息使用端口返回的探测响应消息, 该探测 响应消息中携带了随机数及服务器设备检测到的探测请求消息对应的地址及端 口号; 1 03: 根据探测响应消息中携带的随机数、 地址及端口号确定事件消息使用 端口经网络地址转换后的地址及端口号; 1 02: The receiving server device uses the probe response message returned by the port through the event message, where the probe response message carries the random number and the address and port number corresponding to the probe request message detected by the server device; 1 03: Determine, according to the random number, address, and port number carried in the probe response message, the address and port number of the event message using the network address translated by the port;
1 04: 在单播协商过程中将事件消息使用端口经网络地址转换后的地址及端 口号通知给服务器设备, 使服务器设备根据经网络地址转换后的地址及端口号 发起事件消息。  1 04: In the unicast negotiation process, the event message is notified to the server device by the address and port number of the port after the network address translation, so that the server device initiates an event message according to the address and port number converted by the network address.
其中, 根据探测响应消息中携带的随机数、 地址及端口号确定事件消息使 用端口经网络地址转换后的地址及端口号, 具体包括:  The address and the port number of the event message using the network address translation of the event message are determined according to the random number, the address, and the port number carried in the probe response message, and specifically include:
在确定探测响应消息中携带的随机数与探测请求消息中携带的随机数一致 后, 比较探测响应消息中携带的地址及端口号与发送探测请求消息时的地址及 端口号是否一致;  After determining that the random number carried in the probe response message is consistent with the random number carried in the probe request message, comparing the address and port number carried in the probe response message with the address and port number when sending the probe request message;
如果不一致, 则将探测响应消息中携带的地址及端口号确定为事件消息使 用端口经网络地址转换后的地址及端口号。  If they are inconsistent, the address and port number carried in the probe response message are determined as the address and port number of the event message using the network address translation of the port.
在单播协商过程中将事件消息使用端口经网络地址转换后的地址及端口号 通知给服务器设备, 具体包括:  In the unicast negotiation process, the event message is notified to the server device by using the address and port number of the port after the network address translation, including:
通过一般消息使用端口向服务器设备发送事件消息单播协商请求, 事件消 息单播协商请求中携带事件消息使用端口经网络地址转换后的地址及端口号, 使服务器设备根据事件消息单播协商请求获取事件消息使用端口经网络地址转 换后的地址及端口号。  The event message unicast negotiation request is sent to the server device through the general message using the port. The event message unicast negotiation request carries the event message using the address and port number of the port after the network address translation, so that the server device obtains the unicast negotiation request according to the event message. The event message uses the address and port number of the port after the network address translation.
具体地, 事件消息单播协商请求通过扩展的信元携带事件消息使用端口经 网络地址转换后的地址及端口号。  Specifically, the event message unicast negotiation request uses the address and port number of the port after the network address translation by using the extended cell carrying event message.
本实施例提供的方法, 通过在客户端设备确定事件消息使用端口经网络地 址转换后的地址及端口号后, 将其通知给服务器设备, 使服务器设备据此发起 事件消息, 从而实现了精确时钟同步协议消息在 NAT网络中的传输。 实施例二  The method provided by the embodiment, after the client device determines that the event message uses the address and port number of the port after the network address translation, notifies the server device of the event, so that the server device initiates an event message accordingly, thereby realizing an accurate clock. The synchronization protocol message is transmitted in the NAT network. Embodiment 2
本实施例提供了一种传输精确时钟同步协议消息的方法, 该方法在传输精 确时钟同步协议消息之前, 通过使用自定义的探测消息, 使客户端设备获知网 络中是否存在 NAT , 并在获知事件消息使用端口经 NAT转换后的地址和端口号 后, 将其发送给服务器设备, 从而使服务器设备据此发起事件消息。 其中, 本 实施例不对自定义的具体探测消息进行限定, 此处以握手请求消息及握手响应 消息为例进行说明。 参见图 2 , 本实施例提供的方法流程具体如下: 201: 客户端设备通过事件消息使用端口向服务器设备发送携带随机数的握 手请求消息 ( Handshake.Req ) ; This embodiment provides a method for transmitting an accurate clock synchronization protocol message. Before the accurate clock synchronization protocol message is transmitted, the method uses the customized probe message to enable the client device to know whether a NAT exists in the network, and learns the event. After the message uses the NAT-transformed address and port number, it sends it to the server device, so that the server device initiates an event message accordingly. The specific detection message is not limited in this embodiment. The handshake request message and the handshake response message are used as an example for description. Referring to FIG. 2, the process of the method provided in this embodiment is specifically as follows: 201: The client device sends a handshake request message carrying a random number (Handshake.Req) to the server device by using an event message.
具体地, 事件消息使用端口为 UDP ( User Datagram Protocol , 用户数据包 协议)的 319端口, 一般消息使用端口为 UDP的 320端口, 因此, 该步骤中, 客户 端设备将采用 319端口向服务器设备发送携带随机数的握手请求消息。  Specifically, the event message uses port 319 of the UDP (User Datagram Protocol), and the general message uses port 320 of UDP. Therefore, in this step, the client device sends the port 319 to the server device. A handshake request message carrying a random number.
关于随机数的作用详见后面步骤 202中的描述, 本实施例不对握手请求消息 中携带的具体随机数进行限定。 此外, 握手请求消息中除了携带随机数, 同其 他精确时钟同步协议消息一样, 该握手请求消息中还需要携带该握手请求消息 的源 IP地址、 源端口号, 以及该握手请求消息将要发送到的目的 IP地址和目的 端口号。 在该步骤中, 该握手请求消息中携带的源 IP地址为客户端设备的私网 IP地址, 源端口号为事件消息使用端口的端口号 319 , 而目的 IP地址即为服务器 设备的 IP地址, 目的端口号同样为 319。 此处握手请求消息的作用除了用于建立 NAT子网内客户端到服务器间的通道, 还用于维持客户端设备与服务器设备之间 通道的保活。  For details on the role of the random number, refer to the description in the following step 202. This embodiment does not limit the specific random number carried in the handshake request message. In addition, the handshake request message carries a random number, and like other accurate clock synchronization protocol messages, the handshake request message also needs to carry the source IP address, the source port number of the handshake request message, and the handshake request message to be sent to. Destination IP address and destination port number. In this step, the source IP address carried in the handshake request message is the private network IP address of the client device, the source port number is the port number 319 of the event message using the port, and the destination IP address is the IP address of the server device. The destination port number is also 319. The role of the handshake request message is used to maintain the channel between the client device and the server device in addition to the channel between the client and the server in the NAT subnet.
202: 客户端设备接收服务器设备使用事件消息使用端口返回的握手响应消 息 ( Handshake.Resp ) , 该握手响应消息中携带了随机数及服务器设备检测到 的握手请求消息的源 IP地址和端口号;  202: The client device receives a handshake response message (Handshake.Resp) returned by the server using the event message, where the handshake response message carries a random number and a source IP address and a port number of the handshake request message detected by the server device.
其中, 该握手响应消息中同样需要携带该握手响应消息的源 IP地址、 源端 口号, 以及该握手响应消息将要发送到的目的 IP地址和目的端口号。 针对该步 骤, 该握手响应消息中携带的源 IP地址即为服务器设备的 IP地址, 源端口号 为 319 , 而目的 IP地址为服务器设备检测到的握手请求消息的地址, 目的端口 号为服务器设备检测到的握手请求消息的端口号。 如果服务器设备检测到的握 手请求消息的地址及端口号与客户端设备发送的握手请求消息的地址及端口号 不一致, 则说明客户端设备与服务器设备之间存在 NAT, 因此, 客户端设备根据 握手响应消息中携带的随机数、 地址及端口号即可获知网络中是否存在 NAT。  The source IP address, the source port number, and the destination IP address and destination port number to which the handshake response message is to be sent are also required to be carried in the handshake response message. For the step, the source IP address carried in the handshake response message is the IP address of the server device, the source port number is 319, and the destination IP address is the address of the handshake request message detected by the server device, and the destination port number is the server device. The port number of the detected handshake request message. If the address and port number of the handshake request message detected by the server device are different from the address and port number of the handshake request message sent by the client device, the NAT exists between the client device and the server device. Therefore, the client device according to the handshake The random number, address, and port number carried in the response message can be used to know whether NAT exists in the network.
具体实现时, 客户端设备首先判断握手响应消息中携带的随机数与其发送 的握手请求消息中携带的随机数是否一致, 如果一致, 说明该握手响应消息是 与客户端设备发送的握手请求消息相对应的响应消息。 在此基石出上, 客户端设 备再进一步比较握手响应消息中携带的地址及端口号与发送探测请求消息时的 地址及端口号是否一致, 如果一致, 则判断网络中不存在 NAT, 如果不一致, 则 说明网络中存在 NAT, 同时也说明客户端设备发送的握手请求消息的地址及端口 号被进行了网络地址转换, 而服务器设备检测到的握手请求消息的地址及端口 号即为被转换后的地址及端口号, 因而可将握手响应消息中携带的地址及端口 号确定为事件消息使用端口经网络地址转换后的地址及端口号。 In a specific implementation, the client device first determines whether the random number carried in the handshake response message is consistent with the random number carried in the handshake request message sent by the client, and if the agreement is consistent, the handshake response message is sent to the handshake request message sent by the client device. Corresponding response message. On the basis of this, the client device further compares the address and port number carried in the handshake response message with the address and port number when the probe request message is sent. If they are consistent, it is determined that there is no NAT in the network. Indicates that there is a NAT in the network, and also indicates the address and port of the handshake request message sent by the client device. The number is changed by the network address, and the address and port number of the handshake request message detected by the server device is the translated address and port number, so the address and port number carried in the handshake response message can be determined as an event message. Use the address and port number of the port after the network address translation.
在客户端设备获知事件消息使用端口被进行了网络地址转换后, 为了使服 务器设备能够正常发送事件消息, 客户端设备可在单播协商过程中将事件消息 使用端口经网络地址转换后的地址及端口号通知给服务器设备, 具体通知方式 详见后续步骤。  After the client device learns that the event message uses the port to be network address translated, in order to enable the server device to send the event message normally, the client device may use the address of the port through the network address translation in the unicast negotiation process. The port number is notified to the server device. For details, see the subsequent steps.
203: 客户端设备向服务器设备发送 Announce (通告) 消息单播协商请求, 该 Announce消息单播协商请求可以为 REQUEST-UNICAST-TRANSMI SSION ( Ann ) ; 具体地, 客户端设备既可以通过 319端口 (事件消息使用端口) 发送该 203: The client device sends an Announce message unicast negotiation request to the server device, where the Announce message unicast negotiation request can be REQUEST-UNICAST-TRANSMI SSION ( Ann ); specifically, the client device can pass through port 319 ( Event message using port) send this
Announce消息单播协商请求, 也可以通过 320端口 (一般消息使用端口)发送该 Announce消息单播协商请求, 本实施例不对客户端发送该 Announce消息单播协 商请求所使用的端口进行限定。 无论采用哪个端口发送, 该 Announce消息单播 协商请求中同样会携带源 IP地址(客户端设备的私网 IP地址) 、 源端口号(320 或 319 ) 、 目的 IP地址(服务器设备的 IP地址)和目的端口号 ( 320或 319 ) 。 The Announce message unicast negotiation request may also send the Announce message unicast negotiation request through port 320 (general message use port). This embodiment does not limit the port used by the client to send the Announce message unicast negotiation request. Regardless of which port is used for sending, the Announce message unicast negotiation request also carries the source IP address (the private IP address of the client device), the source port number (320 or 319), and the destination IP address (the IP address of the server device). And the destination port number (320 or 319).
204: 客户端设备接收服务器设备返回的 Announce消息单播协商响应, 该 Announce消息单播协商响应可以为 GRANT_UNICAST_TRANSMISS ION ( Ann ) ;  204: The client device receives an Announce message unicast negotiation response returned by the server device, where the Announce message unicast negotiation response may be GRANT_UNICAST_TRANSMISS ION ( Ann );
其中, 同上述步骤 202 , 服务器设备返回的 Announce消息单播协商响应中同 样携带服务器设备检测到的 Announce消息单播协商请求的地址及端口号, 且如 果存在 NAT, 则服务器设备检测到的 Announce消息单播协商请求的地址和端口号 与客户端设备发送的 Announce消息单播协商请求的地址和端口号不一致。  In the same step 202, the Announce message unicast negotiation response returned by the server device also carries the address and port number of the Announce message unicast negotiation request detected by the server device, and if there is NAT, the Announce message detected by the server device The address and port number of the unicast negotiation request are inconsistent with the address and port number of the Announce message unicast negotiation request sent by the client device.
205: 客户端设备接收服务器设备单播的 Announce消息;  205: The client device receives an Announce message unicast by the server device.
具体地, 该 Announce消息中携带了最优时钟优先级、 时间等级、 时间精度 等信息, 因而客户端设备根据接收到的 Announce消息中携带的信息可以进行时 钟源选择。  Specifically, the Announce message carries information such as an optimal clock priority, a time level, and a time precision, so that the client device can perform clock source selection according to the information carried in the received Announce message.
206: 客户端设备通过一般消息使用端口向服务器设备发送 Sync ( Synchronize , 同步) 消息单播协商请求, 该 Sync消息单播协商请求可以为 REQUEST_UNICAST_TRANSMISSION ( Sync ) ;  206: The client device sends a Sync (Synchronize) message unicast negotiation request to the server device by using a general message using a port, and the Sync message unicast negotiation request may be REQUEST_UNICAST_TRANSMISSION (Sync);
其中, 客户端设备向服务器设备发送 Sync消息单播协商请求是为了请求服 务器设备单播 Sync消息, 以根据该 Sync消息产生和交互时间信息, 并用来同步 时间。 但由于 Sync消息属于事件消息, 需由服务器设备通过事件消息使用端口 ( 319端口)发起, 如果网络中存在 NAT, 服务器预先并不确定该事件消息使用 端口经网络地址转换后的地址及端口号, 对此, 客户端设备在上述步骤 202中获 知事件消息使用端口经网络地址转换后的地址及端口号后, 可在单播协商交互 过程中将其通知给服务器设备。 The client device sends a Sync message unicast negotiation request to the server device to request the server device to unicast the Sync message, to generate and interact time information according to the Sync message, and to synchronize the time. However, since the Sync message belongs to the event message, the server device needs to use the port through the event message. (Port 319) is initiated. If there is a NAT in the network, the server does not determine in advance that the event message uses the address and port number of the port after the network address translation. In this regard, the client device learns that the event message uses the port in step 202. After the address and port number of the network address translation, the device can be notified to the server device during the unicast negotiation interaction.
本实施例不对具体通知方式进行限定, 此处仅以在 Sync消息单播协商请求 中携带该事件消息使用端口经网络地址转换后的地址及端口号为例, 具体实现 时, 可在 Sync消息中扩展信元 ORGANIZATION—EXTENSION, 并通过扩展的信元携 带事件消息使用端口经网络地址转换后的地址及端口号信元。  In this embodiment, the specific notification mode is not limited. The address and port number of the event message using the network address translation port are used as an example in the Sync message unicast negotiation request. In specific implementation, the Sync message may be used in the Sync message. The extended cell ORGANIZATION_EXTENSION, and the extended cell carries the event message using the address and port number cell of the port after the network address translation.
207: 客户端设备接收服务器设备返回的 Sync消息单播协商响应, 该 Sync消 息单播协商响应可以为 GRANT_UNICAST_TRANSMISS ION ( Sync ) ;  207: The client device receives a Sync message unicast negotiation response returned by the server device, where the Sync message unicast negotiation response may be GRANT_UNICAST_TRANSMISS ION (Sync);
针对该步骤, 服务器设备返回的 Sync消息单播协商响应中同样会携带源 IP 地址(服务器设备的私网 IP地址) 、 源端口号(319 ) 、 目的 IP地址(Sync消息 单播协商请求的 IP地址)和目的端口号 (319 ) 。  For this step, the Sync message unicast negotiation response returned by the server device also carries the source IP address (the private IP address of the server device), the source port number (319), and the destination IP address (the IP address of the Sync message unicast negotiation request). Address) and destination port number (319).
208: 客户端设备接收服务器设备通过事件消息使用端口单播的 Sync消息。 具体地, 由于在服务器设备通过事件消息使用端口单播 Sync消息之前, 客 户端设备已经在 Sync消息单播协商过程中将事件消息使用端口经网络地址转换 后的地址及端口号通知给了服务器设备, 因而服务器设备在通过事件消息使用 端口单播 Sync消息时, 携带的目的 I P地址及端口号即为经网络地址转换后的 地址及端口号, 因而该 Sync消息能够准确的发送至客户端设备, 实现了 Sync 消息在 NAT网络中的传输。  208: The client device receives a Sync message that the server device uses the port unicast through the event message. Specifically, before the server device uses the port unicast Sync message by using the event message, the client device has notified the server device of the event message using the port address and port number converted by the network address in the Sync message unicast negotiation process. Therefore, when the server device uses the port unicast Sync message through the event message, the destination IP address and port number carried by the server device are the address and port number converted by the network address, so the Sync message can be accurately sent to the client device. The transmission of Sync messages in the NAT network is implemented.
需要说明的是, 由于在步骤 206中才将客户端设备确定的事件消息使用端 口经网络地址转换后的地址及端口号通知给服务器设备, 因此, 上述步骤 201 和步骤 202除了可以按照上述顺序在步骤 203之前执行外, 还可以在步骤 205 之后且在步骤 206之前执行。 采取在步骤 203之前执行是为了与现有协议流程 保持一致, 且避免 Sync消息间隔时间较长时 NAT表项老化, 具体采用哪种执行 顺序, 本实施例对此不作具体限定。  It should be noted that, in step 206, the event message determined by the client device is notified to the server device by using the address and port number of the port after the network address translation. Therefore, the foregoing steps 201 and 202 may be performed in the above order. Executing before step 203, it may also be performed after step 205 and before step 206. The implementation is performed before the step 203 to keep the same with the existing protocol, and the aging of the NS is not limited.
本实施例提供的方法, 通过在客户端设备确定事件消息使用端口经网络地 址转换后的地址及端口号后, 将其通知给服务器设备, 使服务器设备据此发起 事件消息, 从而实现了精确时钟同步协议消息在 NAT网络中的传输。 实施例三 本实施例提供了一种客户端设备, 用于执行上述实施例一和实施例二中客 户端设备所执行的方法步骤, 参见图 3 , 该客户端设备包括: The method provided by the embodiment, after the client device determines that the event message uses the address and port number of the port after the network address translation, notifies the server device of the event, so that the server device initiates an event message accordingly, thereby realizing an accurate clock. The synchronization protocol message is transmitted in the NAT network. Embodiment 3 The present embodiment provides a client device, which is used to perform the method steps performed by the client device in the first embodiment and the second embodiment. Referring to FIG. 3, the client device includes:
发送模块 301,用于通过事件消息使用端口向服务器设备发送携带随机数的 探测请求消息;  The sending module 301 is configured to send, by using an event message, a probe request message carrying a random number to the server device by using the port;
接收模块 302,用于接收服务器设备通过事件消息使用端口返回的探测响应 消息, 该探测响应消息中携带了随机数及服务器设备检测到的探测请求消息对 应的地址及端口号;  The receiving module 302 is configured to receive a probe response message returned by the server device by using an event message, where the probe response message carries a random number and an address and a port number corresponding to the probe request message detected by the server device;
确定模块 30 用于根据接收模块 302接收到的探测响应消息中携带的随机 数、 地址及端口号确定事件消息使用端口经网络地址转换后的地址及端口号; 通知模块 304,用于在单播协商过程中将确定模块 303确定的事件消息使用 端口经网络地址转换后的地址及端口号通知给服务器设备, 使服务器设备根据 经网络地址转换后的地址及端口号发起事件消息。  The determining module 30 is configured to determine, according to the random number, address, and port number carried in the probe response message received by the receiving module 302, the address and port number of the event message using the network address translated by the port; the notification module 304 is configured to perform unicast During the negotiation, the event message determined by the module 303 is notified to the server device by using the address and port number of the port after the network address translation, so that the server device initiates an event message according to the address and port number converted by the network address.
其中, 确定模块 303, 具体用于在确定探测响应消息中携带的随机数与探测 请求消息中携带的随机数一致后, 比较探测响应消息中携带的地址及端口号与 发送探测请求消息时的地址及端口号是否一致; 如果不一致, 则将探测响应消 息中携带的地址及端口号确定为事件消息使用端口经网络地址转换后的地址及 端口号。  The determining module 303 is specifically configured to: when the random number carried in the probe response message is consistent with the random number carried in the probe request message, compare the address and the port number carried in the probe response message with the sending of the probe request message. If the address and port number are the same, if the number is inconsistent, the address and port number carried in the probe response message are determined as the address and port number of the event message using the network address translation port.
通知模块 304,具体用于通过一般消息使用端口向服务器设备发送事件消息 单播协商请求, 事件消息单播协商请求中携带了事件消息使用端口经网络地址 转换后的地址及端口号, 使服务器设备根据事件消息单播协商请求获取事件消 息使用端口经网络地址转换后的地址及端口号。  The notification module 304 is configured to send an event message unicast negotiation request to the server device by using the general message using the port, and the event message unicast negotiation request carries the address and port number of the event message using the network address translation port, so that the server device According to the event message unicast negotiation request, the event message is obtained by using the address and port number of the port after the network address translation.
本实施例提供的客户端设备, 通过在确定事件消息使用端口经网络地址转 换后的地址及端口号后, 将其通知给服务器设备, 使服务器设备据此发起事件 消息, 从而实现了精确时钟同步协议消息在 NAT网络中的传输。 实施例四  The client device provided in this embodiment notifies the server device by using the address and port number after the network address is translated by using the port, so that the server device initiates an event message according to the event, thereby realizing accurate clock synchronization. The transmission of protocol messages in a NAT network. Embodiment 4
本实施例提供了一种服务器设备, 该服务器设备用于执行上述实施例一和 实施例二中服务器设备所执行的方法步骤, 参见图 4 , 该服务器设备包括: 接收模块 401,用于接收客户端设备通过事件消息使用端口发送的携带随机 数的探测请求消息;  The embodiment of the present invention provides a server device, which is used to perform the method steps performed by the server device in the first embodiment and the second embodiment. Referring to FIG. 4, the server device includes: a receiving module 401, configured to receive a client. The end device sends a probe request message carrying a random number sent by the port through the event message;
返回模块 402 , 用于通过事件消息使用端口向客户端设备返回探测响应消 息, 该探测响应消息中携带了随机数及服务器设备检测到的探测请求消息对应 的地址及端口号; The returning module 402 is configured to return a probe response to the client device by using the event message using the port. The probe response message carries the random number and the address and port number corresponding to the probe request message detected by the server device;
获取模块 40 用于在单播协商过程中获取客户端设备通知的事件消息使用 端口经网络地址转换后的地址及端口号;  The obtaining module 40 is configured to obtain an event message notified by the client device during the unicast negotiation process, using an address and a port number of the port after the network address translation;
发送模块 404,用于根据获取模块 403获取到的经网络地址转换后的地址及 端口号发起事件消息。  The sending module 404 is configured to initiate an event message according to the address and port number converted by the network address obtained by the obtaining module 403.
其中, 获取模块 403, 具体用于接收客户端设备通过一般消息使用端口发送 的事件消息单播协商请求, 事件消息单播协商请求中携带了事件消息使用端口 经网络地址转换后的地址及端口号, 根据事件消息单播协商请求获取事件消息 使用端口经网络地址转换后的地址及端口号。  The obtaining module 403 is specifically configured to receive an event message unicast negotiation request sent by the client device through the general message using the port, and the event message unicast negotiation request carries the address and port number of the event message using the port after the network address translation. According to the event message unicast negotiation request, the event message is obtained by using the address and port number of the port after the network address translation.
本实施例提供的服务器设备, 通过在获取客户端设备通知的事件消息使用 端口经网络地址转换后的地址及端口号后, 据此发起事件消息, 从而实现了精 确时钟同步协议消息在 NAT网络中的传输。 实施例五  The server device provided by the embodiment sends an event message according to the address and the port number converted by the network address after the event message notified by the client device is obtained, thereby implementing an accurate clock synchronization protocol message in the NAT network. Transmission. Embodiment 5
本实施例提供了一种传输精确时钟同步协议消息的系统, 参见图 5, 该系统 包括: 客户端设备 501和服务器设备 502 ;  This embodiment provides a system for transmitting an accurate clock synchronization protocol message. Referring to FIG. 5, the system includes: a client device 501 and a server device 502;
其中, 客户端设备 501如上述实施例三提供的客户端设备;  The client device 501 is the client device provided in the foregoing Embodiment 3;
服务器设备 502如上述实施例四提供的服务器设备。  The server device 502 is the server device provided in the above fourth embodiment.
综上, 本实施例提供的系统, 通过在客户端设备确定事件消息使用端口经 网络地址转换后的地址及端口号后, 将其通知给服务器设备, 使服务器设备据 此发起事件消息, 从而实现了精确时钟同步协议消息在 NAT网络中的传输。 需要说明的是: 上述实施例提供的客户端设备和服务器设备在传输精确时 钟同步协议消息时, 仅以上述各功能模块的划分进行举例说明, 这些功能模块 可以是硬件实现也可以是软件实现, 上述功能模块可以合并实现或者进一步拆 分成子模块来实现。 际应用中, 可以根据需要而将上述功能分配由不同的功能 模块完成, 即将设备的内部结构划分成不同的功能模块, 以完成以上描述的全 部或者部分功能。 另外, 上述实施例提供的客户端设备、 服务器设备、 传输精 确时钟同步协议消息的系统与传输精确时钟同步协议消息的方法实施例属于同 一构思, 其具体实现过程详见方法实施例, 这里不再贅述。 上述本发明实施例序号仅仅为了描述, 不代表实施例的优劣。 本发明实施例中的全部或部分步骤, 可以利用软件实现, 相应的软件程序 可以存储在可读取的存储介质中, 如光盘或硬盘等。 In summary, the system provided by the embodiment, after the client device determines that the event message uses the address and port number of the port after the network address translation, notifies the server device to enable the server device to initiate an event message according to the event, thereby implementing the event message. The transmission of precise clock synchronization protocol messages in a NAT network. It should be noted that, when the client device and the server device provided by the foregoing embodiments transmit the accurate clock synchronization protocol message, only the division of the foregoing functional modules is illustrated. The functional modules may be implemented in hardware or in software. The above functional modules may be implemented in combination or further split into sub-modules. In the inter-application, the above function assignment can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the client device, the server device, the system for transmitting the accurate clock synchronization protocol message, and the method for transmitting the accurate clock synchronization protocol message are in the same concept, and the specific implementation process is described in the method embodiment. Narration. The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments. All or part of the steps in the embodiment of the present invention may be implemented by using software, and the corresponding software program may be stored in a readable storage medium, such as an optical disk or a hard disk.
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的 精神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的 保护范围之内。  The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.

Claims

权利要求书 Claim
1、 一种传输精确时钟同步协议消息的方法, 其特征在于, 所述方法包括: 通过事件消息使用端口向服务器设备发送携带随机数的探测请求消息; 接收所述服务器设备通过所述事件消息使用端口返回的探测响应消息, 该 探测响应消息中携带了随机数及所述服务器设备检测到的所述探测请求消息对 应的地址及端口号; A method for transmitting an accurate clock synchronization protocol message, the method comprising: transmitting, by using an event message, a probe request message carrying a random number to a server device by using an event message; receiving, by the server device, the event message by using the event message a probe response message returned by the port, where the probe response message carries a random number and an address and a port number corresponding to the probe request message detected by the server device;
根据所述探测响应消息中携带的随机数、 地址及端口号确定所述事件消息 使用端口经网络地址转换后的地址及端口号;  Determining, according to the random number, address, and port number carried in the probe response message, the address and port number of the event message using the network address translation of the port;
在单播协商过程中将所述事件消息使用端口经网络地址转换后的地址及端 口号通知给所述服务器设备, 使所述服务器设备根据所述经网络地址转换后的 地址及端口号发起事件消息。  In the unicast negotiation process, the event message is notified to the server device by using the address and port number of the network address translated by the port, so that the server device initiates an event according to the address and port number after the network address translation. Message.
2、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述探测响应消息 中携带的随机数、 地址及端口号确定所述事件消息使用端口经网络地址转换后 的地址及端口号, 具体包括: The method according to claim 1, wherein the determining, according to the random number, the address, and the port number carried in the probe response message, the address and port number of the event message using the network address translated by the port Specifically, including:
在确定所述探测响应消息中携带的随机数与所述探测请求消息中携带的随 机数一致后, 比较所述探测响应消息中携带的地址及端口号与发送所述探测请 求消息时的地址及端口号是否一致;  After determining that the random number carried in the probe response message is consistent with the random number carried in the probe request message, comparing an address and a port number carried in the probe response message with an address when sending the probe request message And whether the port number is consistent;
如果不一致, 则将所述探测响应消息中携带的地址及端口号确定为所述事 件消息使用端口经网络地址转换后的地址及端口号。  If they are inconsistent, the address and port number carried in the probe response message are determined as the address and port number of the event message using the port translated by the network address.
3、 根据权利要求 1所述的方法, 其特征在于, 所述在单播协商过程中将所 述事件消息使用端口经网络地址转换后的地址及端口号通知给所述服务器设 备, 具体包括: The method according to claim 1, wherein, in the unicast negotiation process, the event message is notified to the server device by using a network address translated address and a port number of the port, specifically:
通过一般消息使用端口向所述服务器设备发送事件消息单播协商请求, 所 述事件消息单播协商请求中携带所述事件消息使用端口经网络地址转换后的地 址及端口号 , 使所述服务器设备根据所述事件消息单播协商请求获取所述事件 消息使用端口经网络地址转换后的地址及端口号。  Sending an event message unicast negotiation request to the server device by using a general message using a port, where the event message unicast negotiation request carries the address and port number of the event message using the network address translation of the port, so that the server device Obtaining, according to the event message unicast negotiation request, an address and a port number of the event message using the network address translation of the port.
4、 根据权利要求 1所述的方法, 其特征在于, 所述事件消息单播协商请求 通过扩展的信元携带所述事件消息使用端口经网络地址转换后的地址及端口 号。 The method according to claim 1, wherein the event message unicast negotiation request carries the address and port converted by the network address using the event message by using the extended cell. number.
5、 一种客户端设备, 其特征在于, 所述客户端设备包括: A client device, the client device comprising:
发送模块, 用于通过事件消息使用端口向服务器设备发送携带随机数的探 测请求消息;  a sending module, configured to send, by using an event message, a probe request message carrying a random number to the server device;
接收模块, 用于接收所述服务器设备通过所述事件消息使用端口返回的探 测响应消息, 该探测响应消息中携带了随机数及服务器设备检测到的所述探测 请求消息对应的地址及端口号;  a receiving module, configured to receive a probe response message returned by the server device by using the event message, where the probe response message carries a random number and an address and a port number corresponding to the probe request message detected by the server device;
确定模块, 用于根据所述接收模块接收到的探测响应消息中携带的随机 数、 地址及端口号确定所述事件消息使用端口经网络地址转换后的地址及端口 号;  a determining module, configured to determine, according to a random number, an address, and a port number carried in the probe response message received by the receiving module, an address and a port number of the event message using a network address translated by the port;
通知模块, 用于在单播协商过程中将所述确定模块确定的所述事件消息使 用端口经网络地址转换后的地址及端口号通知给所述服务器设备, 使所述服务 器设备根据所述经网络地址转换后的地址及端口号发起事件消息。  a notification module, configured to notify the server device that the event message determined by the determining module uses a network address translated address and a port number in the unicast negotiation process, so that the server device is configured according to the The address and port number after the network address translation initiates an event message.
6、 根据权利要求 5所述的客户端设备, 其特征在于, 所述确定模块, 具体 用于在确定所述探测响应消息中携带的随机数与所述探测请求消息中携带的随 机数一致后, 比较所述探测响应消息中携带的地址及端口号与发送所述探测请 求消息时的地址及端口号是否一致; 如果不一致, 则将所述探测响应消息中携 带的地址及端口号确定为所述事件消息使用端口经网络地址转换后的地址及端 口号。 The client device according to claim 5, wherein the determining module is configured to: determine that the random number carried in the probe response message is consistent with a random number carried in the probe request message And comparing the address and the port number carried in the probe response message with the address and the port number when the probe request message is sent; if not, determining the address and the port number carried in the probe response message as The event message uses the address and port number of the port after the network address translation.
7、 根据权利要求 5所述的客户端设备, 其特征在于, 所述通知模块, 具体 用于通过所述一般消息使用端口向所述服务器设备发送事件消息单播协商请 求, 所述事件消息单播协商请求中携带了所述事件消息使用端口经网络地址转 换后的地址及端口号, 使所述服务器设备根据所述事件消息单播协商请求获取 所述事件消息使用端口经网络地址转换后的地址及端口号。 The client device according to claim 5, wherein the notification module is configured to send an event message unicast negotiation request to the server device by using the general message using port, the event message list The broadcast negotiation request carries the address and port number of the event message using the network address translation of the port, so that the server device obtains the event message using the port after the network address is translated according to the event message unicast negotiation request. Address and port number.
8、 一种服务器设备, 其特征在于, 所述服务器设备包括: A server device, wherein the server device comprises:
接收模块, 用于接收客户端设备通过事件消息使用端口发送的携带随机数 的探测请求消息; 返回模块, 用于通过所述事件消息使用端口向所述客户端设备返回探测响 应消息, 该探测响应消息中携带了随机数及所述服务器设备检测到的所述探测 请求消息对应的地址及端口号; a receiving module, configured to receive a probe request message that carries a random number sent by the client device by using an event message; a returning module, configured to return, by using the event message, a probe response message to the client device, where the probe response message carries a random number and an address and a port corresponding to the probe request message detected by the server device number;
获取模块, 用于在单播协商过程中获取所述客户端设备通知的所述事件消 息使用端口经网络地址转换后的地址及端口号;  And an obtaining module, configured to obtain, during the unicast negotiation process, the event message notified by the client device, using an address and a port number converted by the network address of the port;
发送模块, 用于根据所述获取模块获取到的经网络地址转换后的地址及端 口号发起事件消息。  And a sending module, configured to initiate an event message according to the network address translated address and the port number obtained by the acquiring module.
9、 根据权利要求 8所述的服务器设备, 其特征在于, 所述获取模块, 具体 用于接收所述客户端设备通过所述一般消息使用端口发送的事件消息单播协商 请求, 所述事件消息单播协商请求中携带了所述事件消息使用端口经网络地址 转换后的地址及端口号 , 根据所述事件消息单播协商请求获取所述事件消息使 用端口经网络地址转换后的地址及端口号。 The server device according to claim 8, wherein the acquiring module is configured to receive an event message unicast negotiation request sent by the client device by using the general message using port, the event message The unicast negotiation request carries the address and port number of the event message using the network address translation of the port, and obtains the address and port number of the event message using the network address translation according to the event message unicast negotiation request. .
10、 一种传输精确时钟同步协议消息的系统, 其特征在于, 所述系统包括: 客户端设备和服务器设备; A system for transmitting a precise clock synchronization protocol message, the system comprising: a client device and a server device;
所述客户端设备如上述权利要求 5至 7中任一权利要求所述的客户端设备 所述服务器设备如上述权利要求 8或权利要求 9所述的服务器设备。  The client device is the client device according to any one of claims 5 to 7, and the server device is the server device according to claim 8 or claim 9.
PCT/CN2012/070493 2011-01-29 2012-01-17 Method, device, and system for transmitting precision clock synchronization protocol message WO2012100698A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110031867.X 2011-01-29
CN201110031867XA CN102098154A (en) 2011-01-29 2011-01-29 Method for transmitting precision clock synchronization protocol messages, apparatus and system thereof

Publications (1)

Publication Number Publication Date
WO2012100698A1 true WO2012100698A1 (en) 2012-08-02

Family

ID=44131035

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/070493 WO2012100698A1 (en) 2011-01-29 2012-01-17 Method, device, and system for transmitting precision clock synchronization protocol message

Country Status (2)

Country Link
CN (1) CN102098154A (en)
WO (1) WO2012100698A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104507155A (en) * 2014-12-17 2015-04-08 苏州寻息电子科技有限公司 Networking synchronization and management method for active node

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098154A (en) * 2011-01-29 2011-06-15 华为技术有限公司 Method for transmitting precision clock synchronization protocol messages, apparatus and system thereof
CN102263698B (en) * 2011-08-11 2014-01-22 福建星网锐捷网络有限公司 Method for establishing virtual channel, method of data transmission and line card
CN105323326B (en) * 2014-06-30 2018-07-24 中国电信股份有限公司 A kind of general conversion platform of terminal room communication, server, system and method
CN107154935B (en) * 2017-04-26 2020-09-11 腾讯科技(深圳)有限公司 Service request method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404618A (en) * 2008-11-04 2009-04-08 中兴通讯股份有限公司 System, apparatus and method for implementing transparent transmission clock in accurate clock synchronization protocol
CN101436923A (en) * 2008-12-05 2009-05-20 华为技术有限公司 Method, equipment and network system for synchronizing clock
CN102098154A (en) * 2011-01-29 2011-06-15 华为技术有限公司 Method for transmitting precision clock synchronization protocol messages, apparatus and system thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2187619A1 (en) * 2008-11-05 2010-05-19 Harris Corporation Improved method, system and apparatus for synchronizing signals

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404618A (en) * 2008-11-04 2009-04-08 中兴通讯股份有限公司 System, apparatus and method for implementing transparent transmission clock in accurate clock synchronization protocol
CN101436923A (en) * 2008-12-05 2009-05-20 华为技术有限公司 Method, equipment and network system for synchronizing clock
CN102098154A (en) * 2011-01-29 2011-06-15 华为技术有限公司 Method for transmitting precision clock synchronization protocol messages, apparatus and system thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104507155A (en) * 2014-12-17 2015-04-08 苏州寻息电子科技有限公司 Networking synchronization and management method for active node
CN104507155B (en) * 2014-12-17 2018-02-27 苏州寻息电子科技有限公司 A kind of networking synchronization of active node and management method

Also Published As

Publication number Publication date
CN102098154A (en) 2011-06-15

Similar Documents

Publication Publication Date Title
US20210014828A1 (en) Multicast-Based Group Communications in Ad-Hoc Arrangements of Wireless Devices
CN104429037B8 (en) Method, equipment and system for being connected to communication equipment
US10863422B2 (en) Mechanisms for ad hoc service discovery
WO2015003566A1 (en) Method, device and system for transmitting packet in multicast domain name system
US9654439B2 (en) Methods and gateways for processing DNS request
TW201225583A (en) Peer-to-peer communication in ad HOC wireless network
WO2012100698A1 (en) Method, device, and system for transmitting precision clock synchronization protocol message
KR101898492B1 (en) Electronic device and method for controlling electronic device
JP2016111711A (en) Access control method and system and access point
WO2012068844A1 (en) Method and system for synchronizing clock of master-slave clock devices
US10142282B2 (en) Methods and gateways for processing DNS request
JP2015511463A (en) Method and apparatus for detecting a wireless device
WO2013117112A1 (en) Sensor network analyzing intercommunicating platform, sensor network intercommunicating method and system
JP2014528227A (en) System and method for reduced power wireless communication
WO2011144083A2 (en) Policy control method and device
RU2013153811A (en) WAYS TO ENSURE PUBLIC AVAILABILITY AND RELATED SYSTEMS AND DEVICES
US8462952B2 (en) Synchronizing management signaling in a network
WO2013185696A2 (en) Data processing method and device
JP2012530413A (en) Method, apparatus, and system for obtaining a local domain name
WO2013159492A1 (en) Method and system for reporting and downloading information
US11115266B2 (en) Priority based selection of time services
WO2016045635A2 (en) Communications method, device, and system
WO2014063624A1 (en) Communication device and data communication method
WO2012088908A1 (en) Management method, system and access node for user line
CN111034121B (en) Ad hoc link local multicast delivery of HTTP responses

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12739861

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12739861

Country of ref document: EP

Kind code of ref document: A1