[go: up one dir, main page]

CN103905579B - Communication method, communication system, platform and related equipment between platform and terminal - Google Patents

Communication method, communication system, platform and related equipment between platform and terminal Download PDF

Info

Publication number
CN103905579B
CN103905579B CN201210589743.8A CN201210589743A CN103905579B CN 103905579 B CN103905579 B CN 103905579B CN 201210589743 A CN201210589743 A CN 201210589743A CN 103905579 B CN103905579 B CN 103905579B
Authority
CN
China
Prior art keywords
terminal
platform
address
communication
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.)
Active
Application number
CN201210589743.8A
Other languages
Chinese (zh)
Other versions
CN103905579A (en
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.)
China Mobile Communications Group Co Ltd
Original Assignee
China Mobile Communications Corp
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 China Mobile Communications Corp filed Critical China Mobile Communications Corp
Priority to CN201210589743.8A priority Critical patent/CN103905579B/en
Publication of CN103905579A publication Critical patent/CN103905579A/en
Application granted granted Critical
Publication of CN103905579B publication Critical patent/CN103905579B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a communication method between a platform and a terminal, which comprises the following steps: a Network Address Translation (NAT) device receives a communication request from a platform, wherein the communication request carries a terminal private network IP address and a terminal number; and the NAT equipment forwards the communication request to a terminal corresponding to the terminal private network IP address or the terminal number, and then the terminal establishes a communication link with the platform and interacts a message based on the communication link. The invention also correspondingly discloses a communication system, a platform and related equipment. By adopting the scheme of the invention, even if the terminal is in a private network, the platform can actively communicate with the terminal after the connection between the platform and the terminal is disconnected, thereby improving the communication efficiency.

Description

平台与终端间的通信方法、通信系统、平台及相关设备Communication method between platform and terminal, communication system, platform and related equipment

技术领域technical field

本发明涉及数据通信领域,尤其涉及一种平台与终端间的通信方法、通信系统、平台及相关设备。The invention relates to the field of data communication, in particular to a communication method between a platform and a terminal, a communication system, a platform and related equipment.

背景技术Background technique

目前,平台与终端间的通信机制主要包括:At present, the communication mechanism between the platform and the terminal mainly includes:

1)终端主动与平台通信。具体的,一般在终端中预置或者配置平台IP地址及通信端口,或者预置或者配置平台通信URL/DNS地址,终端在开机时或者需要交互消息报文时,主动向平台发起连接请求,并在交互的消息中携带终端IP地址,平台根据终端IP地址对终端发起的消息进行应答。该机制下,终端根据需要向平台发送心跳包,以通知平台终端在线,从而保持与平台间的长连接,基于此长连接,终端可以主动与平台进行通信,平台也可以主动与终端进行通信。平台作为服务器端,需要在通信端口上监听终端发起的请求,当终端有请求到达平台后,平台立即进行处理和交互。1) The terminal actively communicates with the platform. Specifically, the platform IP address and communication port are generally preset or configured in the terminal, or the platform communication URL/DNS address is preset or configured. The terminal IP address is carried in the interactive message, and the platform responds to the message initiated by the terminal according to the terminal IP address. Under this mechanism, the terminal sends a heartbeat packet to the platform as needed to notify the platform that the terminal is online, thereby maintaining a long connection with the platform. Based on this long connection, the terminal can actively communicate with the platform, and the platform can also actively communicate with the terminal. As a server, the platform needs to monitor the requests initiated by the terminal on the communication port. When a request from the terminal arrives at the platform, the platform immediately processes and interacts with it.

2)平台主动与终端通信机制。具体的,平台根据终端的IP地址,主动向终端发起请求,或者,当终端具备短信收发能力时,平台向终端发送数据连接拉起短信,终端收到拉起短信后,建立数据连接,并主动与平台发起通信请求并交互消息。该机制下,终端作为服务器端,需要在通信端口上监听平台发起的请求,当平台有请求到达终端后,终端立即进行处理和交互。为减少终端处理的复杂度,可以要求平台主动与终端进行通信时,下发的消息为固定报文的消息,终端收到消息后再发起报文交互请求消息;或者,平台也可发送用户数据包协议(User Datagram Protocol,UDP)消息,要求终端发起连接请求。2) The platform actively communicates with the terminal. Specifically, the platform actively initiates a request to the terminal according to the IP address of the terminal, or, when the terminal has the ability to send and receive short messages, the platform sends a data connection pull-up message to the terminal, and the terminal establishes a data connection after receiving the pull-up message, and actively Initiate a communication request with the platform and exchange messages. Under this mechanism, the terminal, as the server, needs to monitor the request initiated by the platform on the communication port. When the platform has a request to the terminal, the terminal immediately processes and interacts. In order to reduce the complexity of terminal processing, it can be required that when the platform actively communicates with the terminal, the message sent is a fixed message message, and the terminal sends a message exchange request message after receiving the message; or, the platform can also send user data Packet protocol (User Datagram Protocol, UDP) message, requiring the terminal to initiate a connection request.

但是,对于上述通信机制,如果终端与平台之间的长连接因异常情况断开,那么,由于终端无法识别该异常情况,从而不能及时恢复与平台间的连接,影响通信效率;另外,如果终端的IP地址为私网地址,且该终端不具备短信通信的功能,则平台与终端间的连接断开后,平台将无法找到该终端,从而无法进行通信。However, for the above-mentioned communication mechanism, if the long connection between the terminal and the platform is disconnected due to an abnormal situation, then, because the terminal cannot recognize the abnormal situation, it cannot restore the connection with the platform in time, which will affect the communication efficiency; in addition, if the terminal If the IP address of the terminal is a private network address, and the terminal does not have the function of SMS communication, after the connection between the platform and the terminal is disconnected, the platform will not be able to find the terminal and thus cannot communicate.

发明内容Contents of the invention

有鉴于此,本发明的主要目的在于提供一种平台与终端间的通信方法、通信系统、平台及相关设备,平台与IP地址为私网地址的终端间的连接断开后,平台能够找到终端并与其进行通信,从而提高通信效率。In view of this, the main purpose of the present invention is to provide a communication method, communication system, platform and related equipment between the platform and the terminal. After the connection between the platform and the terminal whose IP address is a private network address is disconnected, the platform can find the terminal And communicate with it, so as to improve communication efficiency.

为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, technical solution of the present invention is achieved in that way:

一种平台与终端间的通信方法,包括:A communication method between a platform and a terminal, comprising:

网络地址转换NAT设备接收来自平台的通信请求,所述通信请求携带终端私网IP地址和终端编号;The network address translation NAT device receives a communication request from the platform, and the communication request carries the terminal private network IP address and the terminal number;

所述NAT设备将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端,之后,所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文。The NAT device forwards the communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number, and then, the terminal establishes a communication link with the platform, and reports an interactive message based on the communication link arts.

所述NAT设备将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端为:The NAT device forwards the communication request to the terminal corresponding to the private IP address of the terminal or the terminal number as:

所述NAT设备的IP地址分配方式为静态分配时,将所述通信请求转发到所述私网IP地址对应的端口上;所述NAT设备的IP地址分配方式为动态分配时,在各端口上发送携带所述终端编号的广播消息,之后将所述通信请求转发到对所述广播消息进行应答的端口上。When the IP address distribution method of the NAT device is static distribution, the communication request is forwarded to the port corresponding to the private network IP address; when the IP address distribution method of the NAT device is dynamic distribution, on each port sending a broadcast message carrying the terminal number, and then forwarding the communication request to the port that responds to the broadcast message.

该方法还包括:The method also includes:

所述平台与所述终端交互消息报文结束后,所述终端定时向平台发送心跳包,保持所述通信链路连通,并定时轮询检测网络连接状态,检测到异常断网时,发起并建立与所述平台间的通信链路。After the platform and the terminal exchange message messages, the terminal sends a heartbeat packet to the platform regularly, keeps the communication link connected, and regularly polls to detect the network connection status. When an abnormal disconnection is detected, initiate and A communication link with the platform is established.

所述终端检测到以下一项或多项时,确定为异常断网:When the terminal detects one or more of the following, it is determined to be abnormally disconnected from the network:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

有拨号程序运行且程序未正常执行断开,IP层就已检测到网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

一种平台与终端间的通信方法,包括:A communication method between a platform and a terminal, comprising:

平台需要与处于私网中的终端进行通信时,获取所述终端上次建立连接时的公网地址、终端私网IP地址和终端编号;When the platform needs to communicate with a terminal in the private network, obtain the public network address, the terminal private network IP address and the terminal number when the terminal established a connection last time;

平台根据所述公网地址向相应的NAT设备发送通信请求,建立与所述终端的通信链路,所述通信请求携带所述终端私网IP地址和终端编号。The platform sends a communication request to the corresponding NAT device according to the public network address to establish a communication link with the terminal, and the communication request carries the private network IP address of the terminal and the terminal number.

一种NAT设备,包括:接收模块和发送模块;其中,A kind of NAT equipment, comprises: receiving module and sending module; Wherein,

所述接收模块,用于接收来自平台的通信请求,所述通信请求携带终端私网IP地址和终端编号;The receiving module is configured to receive a communication request from the platform, and the communication request carries a terminal private network IP address and a terminal number;

所述发送模块,用于根据所述接收的通信请求转发给所述终端私网IP地址或终端编号对应的终端,以便所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文。The sending module is configured to forward the received communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number, so that the terminal can establish a communication link with the platform, based on the communication link exchange message packets.

该NAT设备还包括IP地址分配方式确定模块,The NAT device also includes an IP address allocation mode determination module,

所述IP地址分配方式确定模块,用于根据NAT设备配置确定所述NAT设备的IP地址分配方式;The IP address allocation mode determination module is used to determine the IP address allocation mode of the NAT device according to the configuration of the NAT device;

所述发送模块,具体用于在所述IP地址分配方式确定模块确定所述NAT设备的IP地址分配方式为静态分配时,将所述通信请求转发到所述私网IP地址对应的端口上;在所述IP地址分配方式确定模块确定所述NAT设备的IP地址分配方式为动态分配时,在各端口上发送携带所述终端编号的广播消息,之后将所述通信请求转发到对所述广播消息进行应答的端口上。The sending module is specifically configured to forward the communication request to the port corresponding to the private network IP address when the IP address allocation mode determination module determines that the IP address allocation mode of the NAT device is static allocation; When the IP address allocation mode determining module determines that the IP address allocation mode of the NAT device is dynamic allocation, a broadcast message carrying the terminal number is sent on each port, and then the communication request is forwarded to the broadcast message The port on which the message is answered.

一种终端,包括:接收模块、匹配模块和发送模块;其中,A terminal, including: a receiving module, a matching module and a sending module; wherein,

所述接收模块,用于接收NAT设备转发的通信请求以及NAT设备发送的广播消息,所述广播消息携带终端编号;The receiving module is configured to receive a communication request forwarded by the NAT device and a broadcast message sent by the NAT device, the broadcast message carrying a terminal number;

所述匹配模块,用于在接收模块收到广播消息后,将所述广播消息携带的终端编号与自身所属终端的终端编号进行匹配;The matching module is configured to, after the receiving module receives the broadcast message, match the terminal number carried in the broadcast message with the terminal number of the terminal to which it belongs;

所述发送模块,用于在所述匹配模块匹配成功时,返回应答消息。The sending module is configured to return a response message when the matching module succeeds in matching.

该终端还包括:检测模块和连接建立模块;其中,The terminal also includes: a detection module and a connection establishment module; wherein,

所述检测模块,用于在平台与终端交互消息报文结束,但保持通信链路连通的状态下,定时轮询检测网络连接状态;The detection module is used to regularly poll and detect the network connection status when the message message exchange between the platform and the terminal ends, but the communication link is kept connected;

所述连接建立模块,用于在所述检测模块检测到异常断网时,发起并建立与所述平台间的通信链路。The connection establishment module is configured to initiate and establish a communication link with the platform when the detection module detects an abnormal network disconnection.

所述检测模块,具体用于在检测到以下一项或多项时,确定为异常断网:The detection module is specifically used to determine that the network is abnormally disconnected when one or more of the following is detected:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

有拨号程序运行且程序未正常执行断开,IP层就已检测到网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

一种通信系统,包括平台、NAT设备和终端,其中,A communication system, including a platform, a NAT device and a terminal, wherein,

所述平台,用于在需要与处于私网中的终端进行通信时,获取所述终端上次建立连接时的公网地址、终端私网IP地址和终端编号;之后,根据所述公网地址向相应的NAT设备发送通信请求,建立与所述终端的通信链路,所述通信请求携带所述终端私网IP地址和终端编号;The platform is used to obtain the public network address, the terminal private network IP address and the terminal number when the terminal established a connection last time when it needs to communicate with the terminal in the private network; after that, according to the public network address Sending a communication request to the corresponding NAT device to establish a communication link with the terminal, the communication request carrying the private IP address of the terminal and the terminal number;

所述NAT设备,用于将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端,以便所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文;The NAT device is configured to forward the communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number, so that the terminal can establish a communication link with the platform, and interact based on the communication link message message;

所述终端,用于接收NAT设备转发的通信请求以及NAT设备发送的广播消息;以及在收到广播消息后,将所述广播消息携带的终端编号与自身的终端编号进行匹配,匹配成功时,返回应答消息。The terminal is configured to receive the communication request forwarded by the NAT device and the broadcast message sent by the NAT device; and after receiving the broadcast message, match the terminal number carried in the broadcast message with its own terminal number, and when the match is successful, Return a reply message.

所述NAT设备,具体用于在IP地址分配方式为静态分配时,将来自平台的通信请求转发到所述私网IP地址对应的端口上,建立所述平台与所述私网IP地址对应的终端的通信链路;在IP地址分配方式为动态分配时,在各端口上发送携带所述终端编号的广播消息,之后将来自平台的通信请求转发到对所述广播消息进行应答的端口上,建立所述平台与所述终端编号对应的终端的通信链路。The NAT device is specifically used to forward the communication request from the platform to the port corresponding to the private network IP address when the IP address allocation method is static allocation, and to establish a connection between the platform and the private network IP address. The communication link of the terminal; when the IP address allocation mode is dynamic allocation, a broadcast message carrying the terminal number is sent on each port, and then the communication request from the platform is forwarded to the port that responds to the broadcast message, A communication link between the platform and the terminal corresponding to the terminal number is established.

所述终端,还用于在所述平台与所述终端交互消息报文结束后,定时向平台发送心跳包,保持所述通信链路连通,并定时轮询检测网络连接状态,检测到异常断网时,发起并建立与所述平台间的通信链路,The terminal is further configured to regularly send a heartbeat packet to the platform after the exchange message message between the platform and the terminal ends, to keep the communication link connected, and to regularly poll to detect the network connection status, and to detect an abnormal disconnection. network, initiate and establish a communication link with the platform,

所述终端检测到以下一项或多项时,确定为异常断网:When the terminal detects one or more of the following, it is determined to be abnormally disconnected from the network:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

有拨号程序运行且程序未正常执行断开,IP层就已检测到网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

本发明平台与终端间的通信方法、通信系统、平台及相关设备,网络地址转换(NAT)设备接收来自平台的通信请求,所述通信请求携带终端私网IP地址和终端编号;所述NAT设备将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端,之后,所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文。采用本发明所述的方案,即使终端在私网中,平台与终端间的连接断开后,平台也可主动与终端通信,从而能够提高通信效率;另外,终端与平台之间的长连接因异常情况断开后,终端可以识别各种异常情况,及时恢复与平台间的连接,从而进一步提高通信效率。The communication method, communication system, platform and related equipment between the platform and the terminal of the present invention, the network address translation (NAT) equipment receives the communication request from the platform, and the communication request carries the terminal private network IP address and the terminal number; the NAT equipment The communication request is forwarded to the terminal corresponding to the private IP address of the terminal or the terminal number, and then the terminal establishes a communication link with the platform, and exchanges message messages based on the communication link. With the solution of the present invention, even if the terminal is in the private network, the platform can actively communicate with the terminal after the connection between the platform and the terminal is disconnected, thereby improving communication efficiency; in addition, the long connection between the terminal and the platform is due to After the abnormal situation is disconnected, the terminal can identify various abnormal situations and restore the connection with the platform in time, thereby further improving communication efficiency.

附图说明Description of drawings

图1为本发明实施例一种平台与终端间的通信方法流程示意图;1 is a schematic flow diagram of a communication method between a platform and a terminal according to an embodiment of the present invention;

图2为本发明实施例另一种平台与终端间的通信方法流程示意图;FIG. 2 is a schematic flowchart of another communication method between a platform and a terminal according to an embodiment of the present invention;

图3为本发明实施例一种NAT设备的结构示意图;3 is a schematic structural diagram of a NAT device according to an embodiment of the present invention;

图4为本发明实施例一种终端的结构示意图;FIG. 4 is a schematic structural diagram of a terminal according to an embodiment of the present invention;

图5为本发明实施例另一种终端的结构示意图;FIG. 5 is a schematic structural diagram of another terminal according to an embodiment of the present invention;

图6为本发明实施例一种通信系统的结构示意图;FIG. 6 is a schematic structural diagram of a communication system according to an embodiment of the present invention;

图7为本发明实施例1所述的平台与终端间的通信方法流程示意图;7 is a schematic flowchart of a communication method between a platform and a terminal according to Embodiment 1 of the present invention;

图8为本发明实施例2所述的平台与终端间的通信方法流程示意图;FIG. 8 is a schematic flowchart of a communication method between a platform and a terminal according to Embodiment 2 of the present invention;

图9为本发明实施例3所述的平台与终端间的通信方法流程示意图。FIG. 9 is a schematic flowchart of a communication method between a platform and a terminal according to Embodiment 3 of the present invention.

具体实施方式detailed description

本发明的基本思想是:NAT设备接收来自平台的通信请求,所述通信请求携带终端私网IP地址和终端编号;所述NAT设备将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端,之后,所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文。The basic idea of the present invention is: the NAT device receives the communication request from the platform, and the communication request carries the terminal private network IP address and the terminal number; the NAT device forwards the communication request to the terminal private network IP address or the terminal Afterwards, the terminal establishes a communication link with the platform, and exchanges message messages based on the communication link.

图1为本发明实施例一种平台与终端间的通信方法流程示意图,如图1所示,该方法包括:Fig. 1 is a schematic flow chart of a communication method between a platform and a terminal according to an embodiment of the present invention. As shown in Fig. 1, the method includes:

步骤101:NAT设备接收来自平台的通信请求,所述通信请求携带终端私网IP地址和终端编号;Step 101: the NAT device receives a communication request from the platform, and the communication request carries the terminal private network IP address and the terminal number;

步骤102:所述NAT设备将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端,之后,所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文。Step 102: The NAT device forwards the communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number, and then, the terminal establishes a communication link with the platform, based on the communication link Interactive messages.

可选的,所述NAT设备将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端为:所述NAT设备的IP地址分配方式为静态分配时,将所述通信请求转发到所述私网IP地址对应的端口上;所述NAT设备的IP地址分配方式为动态分配时,在各端口上发送携带所述终端编号的广播消息,之后将所述通信请求转发到对所述广播消息进行应答的端口上。Optionally, the NAT device forwarding the communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number is: when the IP address allocation mode of the NAT device is static allocation, forwarding the communication request to the port corresponding to the private network IP address; when the IP address allocation method of the NAT device is dynamic allocation, a broadcast message carrying the terminal number is sent on each port, and then the communication request is forwarded to the corresponding on the port on which the above broadcast message is answered.

可选的,该方法还包括:Optionally, the method also includes:

所述平台与所述终端交互消息报文结束后,所述终端定时向平台发送心跳包,保持所述通信链路连通,并定时轮询检测网络连接状态,检测到异常断网时,发起并建立与所述平台间的通信链路。After the platform and the terminal exchange message messages, the terminal sends a heartbeat packet to the platform regularly, keeps the communication link connected, and regularly polls to detect the network connection status. When an abnormal disconnection is detected, initiate and A communication link with the platform is established.

可选的,所述终端检测到以下一项或多项时,确定为异常断网:Optionally, when the terminal detects one or more of the following items, it is determined to be abnormally disconnected from the network:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

有拨号程序运行且程序未正常执行断开,IP层就已检测到网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

需要说明的是,上述终端检测异常断网的方法不限于应用于按照步骤101、102建立连接并交互消息报文后保持长连接的场景,也可以单独应用于采用其他方式建立连接并交互消息报文后保持长连接的场景,以便及时恢复终端与平台间的连接,例如,某次业务功能需要终端主动与平台通信,并在一次会话结束后,终端仍保持住与平台的通信,当终端与平台间连接断开后,平台主动根据上一次获得的所述终端的IP地址进行通信,若平台与上一次获得的终端的IP地址通信失败,则根据步骤101、102所述的通信方法实现与所述终端的通信。It should be noted that the above-mentioned method for the terminal to detect abnormal network disconnection is not limited to the scenario of maintaining a long connection after establishing a connection and exchanging message messages according to steps 101 and 102, but can also be applied separately to establishing a connection and exchanging message messages in other ways. The scene of maintaining a long connection is described later in this article, so as to restore the connection between the terminal and the platform in time. For example, a certain service function requires the terminal to actively communicate with the platform. After the connection between the platforms is disconnected, the platform actively communicates according to the IP address of the terminal obtained last time. If the communication between the platform and the IP address of the terminal obtained last time fails, the communication method described in steps 101 and 102 is used to communicate with the terminal. communication of the terminal.

本发明实施例还相应地提出了一种平台与终端间的通信方法,如图2所示,该方法包括:The embodiment of the present invention also correspondingly proposes a communication method between the platform and the terminal, as shown in FIG. 2 , the method includes:

步骤201:平台需要与处于私网中的终端进行通信时,获取所述终端上次建立连接时的公网地址、终端私网IP地址和终端编号;Step 201: When the platform needs to communicate with a terminal in the private network, obtain the public network address, the terminal private network IP address and the terminal number when the terminal established a connection last time;

步骤202:平台根据所述公网地址向相应的NAT设备发送通信请求,建立与所述终端的通信链路,所述通信请求携带所述终端私网IP地址和终端编号。Step 202: The platform sends a communication request to the corresponding NAT device according to the public network address to establish a communication link with the terminal, and the communication request carries the terminal's private network IP address and terminal number.

本发明实施例还相应地提出了一种NAT设备,该NAT设备包括:接收模块31和发送模块32;其中,The embodiment of the present invention also correspondingly proposes a NAT device, the NAT device includes: a receiving module 31 and a sending module 32; wherein,

接收模块31,用于接收来自平台的通信请求,所述通信请求携带终端私网IP地址和终端编号;The receiving module 31 is configured to receive a communication request from the platform, the communication request carrying the terminal private network IP address and the terminal number;

发送模块32,用于根据所述接收的通信请求转发给所述终端私网IP地址或终端编号对应的终端,以便所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文。The sending module 32 is configured to forward the received communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number, so that the terminal can establish a communication link with the platform, based on the communication link Interactive messages.

可选的,如图3所示,该NAT设备还包括IP地址分配方式确定模块33,Optionally, as shown in Figure 3, the NAT device also includes an IP address allocation mode determination module 33,

IP地址分配方式确定模块33,用于根据NAT设备配置确定所述NAT设备的IP地址分配方式;The IP address assignment method determination module 33 is used to determine the IP address assignment method of the NAT device according to the NAT device configuration;

发送模块32,具体用于在所述IP地址分配方式确定模块33确定所述NAT设备的IP地址分配方式为静态分配时,将所述通信请求转发到所述私网IP地址对应的端口上;在所述IP地址分配方式确定模块33确定所述NAT设备的IP地址分配方式为动态分配时,在各端口上发送携带所述终端编号的广播消息,之后将所述通信请求转发到对所述广播消息进行应答的端口上。The sending module 32 is specifically configured to forward the communication request to the port corresponding to the private network IP address when the IP address allocation mode determining module 33 determines that the IP address allocation mode of the NAT device is static allocation; When the IP address allocation mode determining module 33 determines that the IP address allocation mode of the NAT device is dynamic allocation, a broadcast message carrying the terminal number is sent on each port, and then the communication request is forwarded to the The port on which broadcast messages are answered.

本发明实施例还相应地提出了一种终端,如图4所示,该终端包括:接收模块41、匹配模块42和发送模块43;其中,The embodiment of the present invention also correspondingly proposes a terminal, as shown in FIG. 4 , the terminal includes: a receiving module 41, a matching module 42, and a sending module 43; wherein,

接收模块41,用于接收NAT设备转发的通信请求以及NAT设备发送的广播消息,所述广播消息携带终端编号;The receiving module 41 is configured to receive a communication request forwarded by the NAT device and a broadcast message sent by the NAT device, the broadcast message carrying a terminal number;

匹配模块42,用于在接收模块41收到广播消息后,将所述广播消息携带的终端编号与自身所属终端的终端编号进行匹配;The matching module 42 is configured to match the terminal number carried in the broadcast message with the terminal number of the terminal to which it belongs after the receiving module 41 receives the broadcast message;

发送模块43,用于在匹配模块42匹配成功时,返回应答消息。The sending module 43 is configured to return a response message when the matching module 42 matches successfully.

可选的,如图5所示,该终端还包括:检测模块51和连接建立模块52;其中,Optionally, as shown in FIG. 5, the terminal further includes: a detection module 51 and a connection establishment module 52; wherein,

检测模块51,用于在平台与终端交互消息报文结束,但保持通信链路连通的状态下,定时轮询检测网络连接状态;The detection module 51 is used to periodically poll and detect the network connection status when the platform and the terminal exchange message message ends, but keep the communication link connected;

连接建立模块52,用于在检测模块51检测到异常断网时,发起并建立与所述平台间的通信链路。The connection establishment module 52 is configured to initiate and establish a communication link with the platform when the detection module 51 detects an abnormal network disconnection.

可选的,检测模块51,具体用于在检测到以下一项或多项时,确定为异常断网:Optionally, the detection module 51 is specifically configured to determine that the network is abnormally disconnected when one or more of the following is detected:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

有拨号程序运行且程序未正常执行断开,IP层就已检测到网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

需要说明的是,终端可以物理上和NAT设备合一,支持NAT设备功能,包括端口映射、IP地址映射等功能。It should be noted that the terminal can be physically integrated with the NAT device and support NAT device functions, including port mapping, IP address mapping and other functions.

本发明实施例还相应地提出了一种通信系统,如图6所示,该通信系统包括平台61、NAT设备62和终端63,其中,The embodiment of the present invention also correspondingly proposes a communication system, as shown in FIG. 6 , the communication system includes a platform 61, a NAT device 62 and a terminal 63, wherein,

平台61,用于在需要与处于私网中的终端进行通信时,获取所述终端上次建立连接时的公网地址、终端私网IP地址和终端编号;之后,根据所述公网地址向相应的NAT设备发送通信请求,建立与所述终端的通信链路,所述通信请求携带所述终端私网IP地址和终端编号;The platform 61 is used to obtain the public network address, the private network IP address of the terminal and the terminal number when the terminal established a connection last time when it is necessary to communicate with the terminal in the private network; The corresponding NAT device sends a communication request to establish a communication link with the terminal, and the communication request carries the private IP address of the terminal and the terminal number;

NAT设备62,用于将所述通信请求转发给所述终端私网IP地址或终端编号对应的终端,以便所述终端建立与所述平台间的通信链路,基于所述通信链路交互消息报文;The NAT device 62 is configured to forward the communication request to the terminal corresponding to the private network IP address of the terminal or the terminal number, so that the terminal can establish a communication link with the platform, and exchange messages based on the communication link message;

终端63,用于接收NAT设备转发的通信请求以及NAT设备发送的广播消息;以及在收到广播消息后,将所述广播消息携带的终端编号与自身的终端编号进行匹配,匹配成功时,返回应答消息。The terminal 63 is used to receive the communication request forwarded by the NAT device and the broadcast message sent by the NAT device; and after receiving the broadcast message, match the terminal number carried by the broadcast message with its own terminal number, and when the match is successful, return Answer message.

可选的,NAT设备62,具体用于在IP地址分配方式为静态分配时,将来自平台61的通信请求转发到所述私网IP地址对应的端口上,建立平台61与所述私网IP地址对应的终端的通信链路;在IP地址分配方式为动态分配时,在各端口上发送携带所述终端编号的广播消息,之后将来自平台61的通信请求转发到对所述广播消息进行应答的端口上,建立平台61与所述终端编号对应的终端的通信链路。Optionally, the NAT device 62 is specifically used to forward the communication request from the platform 61 to the port corresponding to the private network IP address when the IP address allocation method is static allocation, and to establish the connection between the platform 61 and the private network IP address. The communication link of the terminal corresponding to the address; when the IP address allocation mode is dynamic allocation, a broadcast message carrying the terminal number is sent on each port, and then the communication request from the platform 61 is forwarded to respond to the broadcast message A communication link between the platform 61 and the terminal corresponding to the terminal number is established on the port.

可选的,终端63,还用于在所述平台与所述终端交互消息报文结束后,定时向平台发送心跳包,保持所述通信链路连通,并定时轮询检测网络连接状态,检测到异常断网时,发起并建立与所述平台间的通信链路,Optionally, the terminal 63 is also used to regularly send a heartbeat packet to the platform after the interactive message message between the platform and the terminal ends, keep the communication link connected, and regularly poll to detect the network connection status, detect When the network is abnormally disconnected, initiate and establish a communication link with the platform,

可选的,终端63检测到以下一项或多项时,确定为异常断网:Optionally, when the terminal 63 detects one or more of the following, it is determined to be abnormally disconnected from the network:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

有拨号程序运行且程序未正常执行断开,IP层就已检测到网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

下面通过具体实施例对本发明的技术方案作进一步详细说明。The technical solution of the present invention will be further described in detail through specific examples below.

实施例1Example 1

本实施例中,终端发起连接请求,平台对终端进行校验、认证,并与终端间建立长连接,在建立长连接后,检测网络是否异常断开,如果出现异常断网,则立即重新建立连接。In this embodiment, the terminal initiates a connection request, the platform verifies and authenticates the terminal, and establishes a long connection with the terminal. After the long connection is established, it detects whether the network is disconnected abnormally. If there is an abnormal disconnection, it will be re-established immediately connect.

如图7所示,本实施例所述的平台与终端间的通信方法流程具体包括:As shown in FIG. 7, the flow of the communication method between the platform and the terminal described in this embodiment specifically includes:

步骤701:终端向平台发起连接,建立TCP/IP连接,平台获得终端IP地址。Step 701: The terminal initiates a connection to the platform, establishes a TCP/IP connection, and the platform obtains the terminal IP address.

步骤702:终端与平台建立连接后,获得临时Token。Step 702: After establishing a connection with the platform, the terminal obtains a temporary Token.

在此连接内,后续终端每次与平台交互报文,都需携带此临时Token,作为此次通信连接及消息报文交互的认证字段使用。In this connection, each time the subsequent terminal interacts with the platform, it needs to carry this temporary token, which is used as the authentication field for this communication connection and message message interaction.

具体的,平台将临时Token与终端发起TCP/IP连接携带的IP地址、端口一一绑定,当连接断开后,临时Token也过期。Specifically, the platform binds the temporary Token with the IP address and port carried by the TCP/IP connection initiated by the terminal. When the connection is disconnected, the temporary Token also expires.

临时Token由平台根据终端上报的终端编号(平台预存,或者预存与终端编号绑定的逻辑号码)、IP地址、端口和平台生成的随机数根据一定算法计算获得。采用Token可以保证长连接通信的安全性。The temporary token is calculated by the platform according to a certain algorithm based on the terminal number reported by the terminal (pre-stored on the platform, or a logical number bound to the terminal number), IP address, port, and platform-generated random number. Using Token can ensure the security of long connection communication.

步骤703:终端与平台交互消息报文,完成相关逻辑操作。Step 703: The terminal and the platform exchange message messages to complete relevant logical operations.

步骤704:消息交互结束。平台不断开TCP/IP连接,并保持session连接,终端也不主动断开TCP/IP连接。Step 704: The message interaction ends. The platform does not disconnect the TCP/IP connection, and maintains the session connection, and the terminal does not actively disconnect the TCP/IP connection.

步骤705:终端定时向平台发送心跳包,平台定时收到心跳包保持此连接。Step 705: The terminal regularly sends heartbeat packets to the platform, and the platform receives the heartbeat packets regularly to maintain the connection.

步骤706:终端检测网络是否异常断开,若出现异常,终端与平台断开TCP/IP连接,终端需主动向平台再发起连接请求,平台与终端重新建立连接。Step 706: The terminal detects whether the network is abnormally disconnected. If there is an abnormality, the terminal disconnects the TCP/IP connection with the platform, and the terminal needs to actively initiate a connection request to the platform, and the platform and the terminal re-establish a connection.

这里,检测进程启动后,终端可以在PPP连接或IP连接下,定时轮询检测网络连接状态。具体的,可以根据在出现以下情况是,确定为异常断网:Here, after the detection process is started, the terminal may regularly poll and detect the network connection status under the PPP connection or IP connection. Specifically, it can be determined as an abnormal disconnection according to the following situations:

上层应用在消息通信中,未完成完整消息应答,无法与平台通信;The upper-layer application cannot communicate with the platform without completing a complete message response during message communication;

若有拨号程序运行,程序未正常执行断开,IP层就已检测网络断开;If there is a dial-up program running and the program is not disconnected normally, the IP layer has detected that the network is disconnected;

未检测到网络口断开连接,但IP层已无法连通。The disconnection of the network port is not detected, but the IP layer is no longer connected.

需要说明的是,终端检测网络状况及断网后连接程序是操作系统级进程,操作系统启动后一并启动,不能被暂停、关闭或修改,另外,当终端与平台间TCP/IP连接断开,平台能够立刻检测到TCP连接已断开,平台释放已建立的TCP/IP连接,以及应用层已建立的Session。It should be noted that the terminal detects the network status and the connection program after the network is disconnected is an operating system-level process. After the operating system is started, it starts together and cannot be suspended, closed or modified. In addition, when the TCP/IP connection between the terminal and the platform is disconnected , the platform can immediately detect that the TCP connection has been disconnected, and the platform releases the established TCP/IP connection and the session established by the application layer.

重新建立连接后,平台可随时向终端发送交互消息,进行各种操作和配置。After the connection is re-established, the platform can send interactive messages to the terminal at any time for various operations and configurations.

实施例2Example 2

本实施例描述终端处于私网中,私网地址不变的情况下,平台与终端TCP/IP连接断开,平台主动连接终端通信的过程。This embodiment describes a process in which the terminal is in a private network and the private network address remains unchanged, the TCP/IP connection between the platform and the terminal is disconnected, and the platform actively connects to the terminal for communication.

图8为本发明实施例2中平台与终端间的通信方法流程示意图,如图8所示,该流程具体包括:FIG. 8 is a schematic flow diagram of a communication method between a platform and a terminal in Embodiment 2 of the present invention. As shown in FIG. 8, the flow specifically includes:

步骤801:终端在主动发起与平台的通信中,发送消息包携带终端私网IP地址、NAT设备为终端固定分配的编号。Step 801: When the terminal actively initiates communication with the platform, it sends a message packet carrying the private network IP address of the terminal and the number permanently assigned to the terminal by the NAT device.

步骤802:当终端与平台断开通信后,平台解开终端上次建立TCP/IP连接中发送的NAT穿越消息,获得终端私网IP地址、终端编号。Step 802: After the terminal disconnects from the platform, the platform unlocks the NAT traversal message sent by the terminal when establishing a TCP/IP connection last time, and obtains the terminal's private network IP address and terminal number.

这里,NAT穿越消息即与业务逻辑无关的消息,在进行业务消息交互前发送。Here, the NAT traversal message is a message that has nothing to do with business logic, and is sent before business message interaction.

步骤803:平台向NAT设备(对应公网地址)发送通信请求,所述通信请求携带终端私网IP地址和终端编号。Step 803: The platform sends a communication request to the NAT device (corresponding to the public network address), and the communication request carries the private network IP address of the terminal and the terminal number.

步骤804:分配方式为静态分配的NAT设备收到平台发送的通信请求,将发送到公网地址的消息转发到私网地址绑定的端口上,从而建立平台与终端的通信链路,并交互消息。Step 804: The statically allocated NAT device receives the communication request sent by the platform, and forwards the message sent to the public network address to the port bound to the private network address, thereby establishing a communication link between the platform and the terminal, and interacting information.

实施例3Example 3

本实施例描述终端处于私网中,私网地址改变的情况下,平台与终端TCP/IP连接断开,平台主动连接终端通信的过程。This embodiment describes a process in which the terminal is in a private network and the private network address changes, the TCP/IP connection between the platform and the terminal is disconnected, and the platform actively connects to the terminal for communication.

图9为本发明实施例3中平台与终端间的通信方法流程示意图,如图9所示,该流程具体包括:FIG. 9 is a schematic flowchart of a communication method between a platform and a terminal in Embodiment 3 of the present invention. As shown in FIG. 9, the process specifically includes:

步骤901:终端在主动发起与平台的通信中,发送消息包携带终端私网IP地址、NAT设备为终端固定分配的编号。Step 901: When the terminal actively initiates communication with the platform, it sends a message packet carrying the private network IP address of the terminal and the number permanently assigned to the terminal by the NAT device.

步骤902:当终端与平台断开通信后,平台解开终端上次建立TCP/IP连接中发送的NAT穿越消息,获得终端私网IP地址、终端编号。Step 902: After the terminal disconnects from the platform, the platform unlocks the NAT traversal message sent by the terminal when establishing a TCP/IP connection last time, and obtains the terminal's private network IP address and terminal number.

这里,NAT穿越消息即与业务逻辑无关的消息,在进行业务消息交互前发送。Here, the NAT traversal message is a message that has nothing to do with business logic, and is sent before business message interaction.

步骤903:平台向NAT设备(对应公网地址)发送通信请求,所述通信请求携带终端私网IP地址和终端编号。Step 903: The platform sends a communication request to the NAT device (corresponding to the public network address), and the communication request carries the private network IP address of the terminal and the terminal number.

步骤904:分配方式为动态分配的NAT设备收到平台发送的通信请求后,在各端口上发送广播消息,广播消息中至少携带终端编号,当有终端收到此广播消息时,匹配自己的终端编号,若与终端编号匹配(可携带断连接前携带的Token进行认证校验)的终端对广播消息应答,NAT设备根据应答的端口,将平台发送的消息转发到此端口,终端对平台发送的消息报文进行应答,平台根据此应答与终端建立通信链路。Step 904: After receiving the communication request sent by the platform, the NAT device whose allocation mode is dynamic allocation sends a broadcast message on each port. The broadcast message carries at least the terminal number. When a terminal receives this broadcast message, it matches its own terminal Number, if the terminal that matches the terminal number (it can carry the Token carried before disconnection for authentication verification) responds to the broadcast message, the NAT device forwards the message sent by the platform to this port according to the port of the response, and the terminal responds to the message sent by the platform The message message is used to respond, and the platform establishes a communication link with the terminal according to the response.

具体的,平台发送的通信请求还可以携带以下一项或多项信息:通知此编号的终端与平台建立连接、消息类型(如连接消息)、平台IP地址,另外,还可携带断连接前携带的Token,重新建立连接后,再携带新的Token。Specifically, the communication request sent by the platform can also carry one or more of the following information: notify the terminal of this number to establish a connection with the platform, message type (such as a connection message), and the platform IP address. Token, after the connection is re-established, a new Token will be carried.

NAT设备转发的广播消息为平台通知此编号的终端与平台建立连接,消息中包括终端编号。The broadcast message forwarded by the NAT device notifies the platform of the numbered terminal to establish a connection with the platform, and the message includes the terminal number.

对于终端的IP地址是公网的IP地址的情况,若终端IP地址不变化,则平台只需记住终端每次通信的IP地址,即可主动与终端连接进行通信;若终端IP地址变化(即终端每次发起PPP连接获得的IP地址是变化的),只要此次PPP连接不断开,平台根据终端此次分配的IP地址都可以找到终端,若PPP连接断开,则终端会重新发起PPP连接请求,与平台建立新的连接,若希望PPP连接不断开,可以由终端与平台间保持长连接,由此保持住此PPP连接。For the case where the IP address of the terminal is the IP address of the public network, if the terminal IP address does not change, the platform only needs to remember the IP address of the terminal for each communication, and can actively connect and communicate with the terminal; if the terminal IP address changes ( That is, the IP address obtained by the terminal every time it initiates a PPP connection changes), as long as the PPP connection is not disconnected this time, the platform can find the terminal according to the IP address assigned by the terminal this time, if the PPP connection is disconnected, the terminal will re-initiate PPP Connection request, to establish a new connection with the platform. If you want the PPP connection not to be disconnected, you can maintain a long connection between the terminal and the platform, thereby maintaining the PPP connection.

本发明所述的方案可应用于需要平台主动与终端通信的业务(如智能家居、终端远程管理等业务)中,通过本发明,终端与平台交互后,保持住长连接,若长连接断开,终端进行各种异常处理发起连接;若终端未能诊断异常,终端与平台间连接已断开,平台能够主动与终端建立通信连接,并交互消息,因此,即使平台与终端不处于同个网段中,平台仍可主动找到终端,并向终端发起各种消息,进行各种操作和配置。The solution described in the present invention can be applied to services that require the platform to actively communicate with the terminal (such as smart home, terminal remote management, etc.). Through the present invention, after the terminal interacts with the platform, it maintains a long connection. If the long connection is disconnected , the terminal performs various abnormal processing to initiate a connection; if the terminal fails to diagnose the abnormality, the connection between the terminal and the platform has been disconnected, and the platform can actively establish a communication connection with the terminal and exchange messages. Therefore, even if the platform and the terminal are not in the same network During the period, the platform can still actively find the terminal, send various messages to the terminal, and perform various operations and configurations.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (11)

1. A method for communication between a platform and a terminal, the method comprising:
the NAT equipment receives a communication request from a platform, wherein the communication request carries a terminal private network IP address and a terminal number, and the communication request also carries one or more of the following items of information: informing a terminal with a terminal number to establish connection, a message type and a platform IP address with a platform;
the NAT equipment forwards the communication request to a terminal corresponding to the terminal private network IP address or the terminal number, and then the terminal establishes a communication link with the platform and interacts a message based on the communication link;
after the platform and the terminal exchange message messages, the terminal sends heartbeat packets to the platform at regular time, keeps the communication link connected, polls the network connection state at regular time, and initiates and establishes a communication link with the platform when detecting abnormal network disconnection.
2. The method of claim 1, wherein the forwarding of the communication request to the terminal corresponding to the terminal private network IP address or the terminal number by the NAT device is:
when the IP address allocation mode of the NAT equipment is static allocation, the communication request is forwarded to a port corresponding to the private network IP address; and when the IP address allocation mode of the NAT equipment is dynamic allocation, sending a broadcast message carrying the terminal number on each port, and then forwarding the communication request to a port responding to the broadcast message.
3. The method according to claim 1, wherein the terminal determines an abnormal network outage when detecting one or more of the following:
the upper layer is applied to message communication, does not complete message response and cannot communicate with the platform;
if the dialing program runs and the program is not normally disconnected, the IP layer detects the network disconnection;
the disconnection of the network port is not detected, but the IP layer can not be connected.
4. A method for communication between a platform and a terminal, the method comprising:
when a platform needs to communicate with a terminal in a private network, acquiring a public network address, a terminal private network IP address and a terminal number when the terminal establishes connection last time;
the platform sends a communication request to corresponding NAT equipment according to the public network address, and establishes a communication link with the terminal, wherein the communication request carries the terminal private network IP address and the terminal number, and the communication request also carries one or more of the following information: informing a terminal with a terminal number to establish connection, a message type and a platform IP address with a platform;
after the platform and the terminal exchange message messages, the terminal sends heartbeat packets to the platform at regular time, keeps the communication link connected, polls the network connection state at regular time, and initiates and establishes a communication link with the platform when detecting abnormal network disconnection.
5. A NAT device, comprising: the device comprises a receiving module and a sending module; wherein,
the receiving module is used for receiving a communication request from a platform, wherein the communication request carries a terminal private network IP address and a terminal number, and the communication request also carries one or more of the following items of information: informing the numbered terminal to establish connection, message type and platform IP address with the platform;
the sending module is used for forwarding the received communication request to a terminal corresponding to the terminal private network IP address or the terminal number so as to establish a communication link between the terminal and the platform and exchange message messages based on the communication link;
after the platform and the terminal exchange message messages, the terminal sends heartbeat packets to the platform at regular time, keeps the communication link connected, polls the network connection state at regular time, and initiates and establishes a communication link with the platform when detecting abnormal network disconnection.
6. The NAT device of claim 5, wherein the NAT device further comprises an IP address assignment determination module,
the IP address allocation mode determining module is used for determining the IP address allocation mode of the NAT equipment according to the NAT equipment configuration;
the sending module is specifically configured to forward the communication request to a port corresponding to the private network IP address when the IP address allocation manner determining module determines that the IP address allocation manner of the NAT device is static allocation; and when the IP address allocation mode determining module determines that the IP address allocation mode of the NAT equipment is dynamic allocation, sending a broadcast message carrying the terminal number on each port, and then forwarding the communication request to a port responding to the broadcast message.
7. A terminal, characterized in that the terminal comprises: the device comprises a receiving module, a matching module and a sending module; wherein,
the receiving module is configured to receive a communication request forwarded by the NAT device and a broadcast message sent by the NAT device, where the broadcast message carries a terminal number, and the communication request carries one or more of the following information: informing a terminal with a terminal number to establish connection, a message type and a platform IP address with a platform;
the matching module is used for matching the terminal number carried by the broadcast message with the terminal number of the terminal to which the matching module belongs after the receiving module receives the broadcast message;
the sending module is used for returning a response message when the matching module is successfully matched;
wherein, this terminal station still includes: the device comprises a detection module and a connection establishing module; wherein,
the detection module is used for polling and detecting the network connection state at regular time when the platform and the terminal exchange message is finished but the communication link is kept connected;
and the connection establishing module is used for initiating and establishing a communication link with the platform when the detection module detects abnormal network disconnection.
8. The terminal according to claim 7, wherein the detecting module is specifically configured to determine that the network is abnormally disconnected when one or more of the following are detected:
the upper layer is applied to message communication, does not complete message response and cannot communicate with the platform;
if the dialing program runs and the program is not normally disconnected, the IP layer detects the network disconnection;
the disconnection of the network port is not detected, but the IP layer can not be connected.
9. A communication system comprising a platform, a NAT device and a terminal, wherein,
the platform is used for acquiring a public network address, a terminal private network IP address and a terminal number when the terminal establishes connection last time when the terminal needs to communicate with a terminal in a private network; then, a communication request is sent to the corresponding NAT equipment according to the public network address, a communication link with the terminal is established, the communication request carries the terminal private network IP address and the terminal number, and the communication request also carries one or more of the following information: informing a terminal with a terminal number to establish connection, a message type and a platform IP address with a platform;
the NAT equipment is used for forwarding the communication request to a terminal corresponding to the terminal private network IP address or the terminal number so that the terminal can establish a communication link with the platform and exchange message messages based on the communication link;
the terminal is used for receiving the communication request forwarded by the NAT equipment and the broadcast message sent by the NAT equipment; after receiving the broadcast message, matching the terminal number carried by the broadcast message with the terminal number of the broadcast message, and returning a response message when the matching is successful; and the system is also used for sending heartbeat packets to the platform at regular time after the platform and the terminal exchange message are finished, keeping the communication link connected, polling and detecting the network connection state at regular time, and initiating and establishing the communication link with the platform when abnormal network disconnection is detected.
10. The system of claim 9,
the NAT device is specifically used for forwarding a communication request from a platform to a port corresponding to the private network IP address when the IP address allocation mode is static allocation, and establishing a communication link between the platform and a terminal corresponding to the private network IP address; and when the IP address allocation mode is dynamic allocation, sending a broadcast message carrying the terminal number on each port, then forwarding a communication request from the platform to a port responding to the broadcast message, and establishing a communication link between the platform and the terminal corresponding to the terminal number.
11. The system of claim 9 or 10,
when the terminal detects one or more of the following conditions, the terminal determines that the network is abnormally disconnected:
the upper layer is applied to message communication, does not complete message response and cannot communicate with the platform;
if the dialing program runs and the program is not normally disconnected, the IP layer detects the network disconnection;
the disconnection of the network port is not detected, but the IP layer can not be connected.
CN201210589743.8A 2012-12-28 2012-12-28 Communication method, communication system, platform and related equipment between platform and terminal Active CN103905579B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210589743.8A CN103905579B (en) 2012-12-28 2012-12-28 Communication method, communication system, platform and related equipment between platform and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210589743.8A CN103905579B (en) 2012-12-28 2012-12-28 Communication method, communication system, platform and related equipment between platform and terminal

Publications (2)

Publication Number Publication Date
CN103905579A CN103905579A (en) 2014-07-02
CN103905579B true CN103905579B (en) 2018-01-30

Family

ID=50996733

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210589743.8A Active CN103905579B (en) 2012-12-28 2012-12-28 Communication method, communication system, platform and related equipment between platform and terminal

Country Status (1)

Country Link
CN (1) CN103905579B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468380A (en) * 2014-11-14 2015-03-25 上海斐讯数据通信技术有限公司 Interface communication method of access point device and server interaction
CN104570755A (en) * 2015-01-21 2015-04-29 苏州奥莱维信息技术有限公司 Intelligent home control method based on mobile phone
CN105227692B (en) * 2015-09-17 2019-05-03 青岛海信电器股份有限公司 A kind of NAT through method and gateway
CN106453533B (en) * 2016-09-28 2019-07-02 深圳市讯方技术股份有限公司 Learning control mode and system based on cloud desktop
CN106911508B (en) * 2017-02-28 2020-03-06 杭州迪普科技股份有限公司 DNS configuration recovery method and device
CN110445883A (en) * 2018-05-03 2019-11-12 海信集团有限公司 A kind of communication means and device of Internet of Things
CN108881511A (en) * 2018-06-11 2018-11-23 天津卓越信通科技有限公司 A kind of homogeneous network communication means
CN108881510A (en) * 2018-06-11 2018-11-23 天津卓越信通科技有限公司 A kind of homogeneous network domain name management method
CN110597192A (en) * 2019-08-09 2019-12-20 工业互联网创新中心(上海)有限公司 Workflow execution method, system and storage medium
CN111917451B (en) * 2020-07-10 2022-09-06 华力智芯(成都)集成电路有限公司 Data transmission method and device, satellite module and storage medium
CN115633099B (en) * 2022-10-11 2025-07-15 飞驰云联(南京)科技有限公司 A transmission protocol method suitable for high bandwidth delay systems

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1516409A (en) * 2003-08-26 2004-07-28 中兴通讯股份有限公司 Method for making medium stream pass through network address converter
CN1561061A (en) * 2004-02-27 2005-01-05 Ut斯达康通讯有限公司 Method for two-way access by NAT
CN101043447A (en) * 2007-04-23 2007-09-26 重庆大学 Method for mapping dynamically inside and outside network of server based on DDNS and NAT
CN102281335A (en) * 2010-06-09 2011-12-14 北京和信锐智科技有限公司 Method for keeping NAT (Network Address Translation) binding

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW574805B (en) * 2002-07-25 2004-02-01 Leadtek Research Inc Network address translation system and method thereof
CN100486176C (en) * 2006-04-27 2009-05-06 中兴通讯股份有限公司 Method for managing user side equipment through network address translation gateway
CN101141420B (en) * 2007-09-05 2012-07-11 杭州华三通信技术有限公司 Method and system for performing data communication between private network and public network
CN101478493B (en) * 2009-02-10 2011-02-02 杭州华三通信技术有限公司 Method and device for NAT through communication
CN102281334B (en) * 2010-06-11 2015-08-12 中兴通讯股份有限公司 A kind of management control method of catv terminal and system and access server
CN101909284B (en) * 2010-07-16 2013-06-05 深圳市融创天下科技股份有限公司 Data transmission method and system for mobile terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1516409A (en) * 2003-08-26 2004-07-28 中兴通讯股份有限公司 Method for making medium stream pass through network address converter
CN1561061A (en) * 2004-02-27 2005-01-05 Ut斯达康通讯有限公司 Method for two-way access by NAT
CN101043447A (en) * 2007-04-23 2007-09-26 重庆大学 Method for mapping dynamically inside and outside network of server based on DDNS and NAT
CN102281335A (en) * 2010-06-09 2011-12-14 北京和信锐智科技有限公司 Method for keeping NAT (Network Address Translation) binding

Also Published As

Publication number Publication date
CN103905579A (en) 2014-07-02

Similar Documents

Publication Publication Date Title
CN103905579B (en) Communication method, communication system, platform and related equipment between platform and terminal
US9729501B2 (en) System and data card for stateless automatic configuration of IPv6 address and method for implementing the same
JP5364671B2 (en) Terminal connection status management in network authentication
JP5402926B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND COMMUNICATION CONTROL PROGRAM
CN101453495B (en) Method, system and equipment for preventing authentication address resolution protocol information loss
EP1502463B1 (en) Method , apparatus and computer program product for checking the secure use of routing address information of a wireless terminal device in a wireless local area network
US9918353B2 (en) 802.1X access session keepalive method, device, and system
US20080281973A1 (en) Management Method, Device And System For Session Connection
EP2986042B1 (en) Client, server, and remote authentication dial in user service capability negotiation method and system
WO2012163007A1 (en) Method for solving internet protocol address allocation conflict and related device and system thereof
CN105471983B (en) A kind of method and system for establishing Internet of Things communication
CN107517138A (en) Equipment detection method and device
CN104601566A (en) Authentication method and device
JP5604389B2 (en) Communication system, router device, and router switching method
CN101312456B (en) Method and system for survival monitoring session of subscriber
CN104009961B (en) A kind of pppoe session mark distributing method and equipment
CN107566213B (en) Keep-alive detection method and device
CN102917082B (en) Penetrate information push method and the system of network address translation
CN103685398B (en) Communication connection method for building up and communication system
CN101325587A (en) Method for monitoring DHCP conversation
CN1645794A (en) Access user management system and access user management apparatus
CN106131177B (en) Message processing method and device
CN108810611A (en) The control system and method for Multimedia Fusion terminal start-up course
CN102244620A (en) Method and system for determining association relationship between gateway and equipment
WO2013189398A2 (en) Application data push method, device, and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant