CN113691591B - Data transmission method, device and computer readable storage medium - Google Patents

Data transmission method, device and computer readable storage medium Download PDF

Info

Publication number
CN113691591B
CN113691591B CN202110884741.0A CN202110884741A CN113691591B CN 113691591 B CN113691591 B CN 113691591B CN 202110884741 A CN202110884741 A CN 202110884741A CN 113691591 B CN113691591 B CN 113691591B
Authority
CN
China
Prior art keywords
gateway
data transmission
server
address
tcp connection
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
CN202110884741.0A
Other languages
Chinese (zh)
Other versions
CN113691591A (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
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110884741.0A priority Critical patent/CN113691591B/en
Publication of CN113691591A publication Critical patent/CN113691591A/en
Application granted granted Critical
Publication of CN113691591B publication Critical patent/CN113691591B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/169Special adaptations of TCP, UDP or IP for interworking of IP based networks with other networks 

Abstract

The invention discloses a data transmission method, which comprises the following steps: when receiving IP address updating information sent by the gateway, updating the IP address of the registered gateway according to the IP address updating information; when data transmission exists, an HTTP GET request is sent to the gateway according to the IP address of the registered gateway; when a TCP connection establishment request of a gateway is received, establishing TCP connection with the gateway; and when the data transmission is detected to be finished, sending a message for closing the TCP connection to the gateway and disconnecting the TCP connection. The invention also provides a data transmission device and a computer readable storage medium. The server updates the IP address of the registered gateway by receiving the IP address updating information sent by the gateway to obtain the IP address updated by the gateway in real time, automatically establishes TCP connection with the gateway for data transmission when the server has data transmission, and immediately disconnects the TCP connection when the server does not have the data transmission, thereby achieving the purposes of reducing the load pressure of server resources, network bandwidth and firewall and saving the energy consumption.

Description

Data transmission method, device and computer readable storage medium
Technical Field
The present invention relates to the field of terminal technologies, and in particular, to a data transmission method and apparatus, and a computer-readable storage medium.
Background
With the development of home broadband services, a gateway deployed in a user home becomes a first gateway for a user to surf the internet, and each large operator can increase the management and monitoring of the home gateway, so that the home networking requirements of the user are practically guaranteed. In order to better manage the home gateway, each management platform will usually establish a TCP connection with the home gateway.
Because the home gateway can occasionally replace its own IP address under the policy configured by the operator BRAS system, it is difficult for the management platform to actively connect to the home gateway, and the method usually adopted is that the home gateway actively sends a connection establishment request to the service platform, and when the management platform has a communication demand, the management platform can directly use a long connection channel to send to the gateway. However, this method results in that the management platform needs to maintain a long connection channel with each gateway, and as the number of gateways managed by the management platform increases, the management platform may need to manage millions and millions of home gateways, which requires to maintain millions/millions of TCP connections, and causes huge pressure and performance consumption on server resources, network bandwidth, and firewalls.
The above is only for the purpose of assisting understanding of the technical solution of the present invention, and does not represent an admission that the above is the prior art.
Disclosure of Invention
The invention mainly aims to provide a data transmission method, a data transmission device and a computer readable storage medium, and aims to solve the problems that a server management platform and each gateway keep a long connecting channel for communication, and huge pressure and performance consumption are caused on server resources, network bandwidth and firewalls.
In order to achieve the above object, the present invention provides a data transmission method, where the data transmission method is applied to a server, and the data transmission method includes:
when IP address updating information which contains the IP address of the gateway and is sent by the gateway is received, the registered IP address of the corresponding gateway is updated according to the IP address updating information;
when detecting that data transmission exists, sending an HTTP GET request to a gateway according to the IP address of the registered gateway;
when a TCP connection establishment request returned by the gateway is received, establishing TCP connection with the gateway for data transmission;
and when the data transmission is detected to be finished, sending a message for closing the TCP connection to the gateway, and disconnecting the TCP connection.
Optionally, the step of sending an HTTP GET request to the gateway according to the IP address of the registered gateway includes:
an HTTP GET request is sent to the gateway over the TR069 channel and the IP address of the registered gateway.
Optionally, between the step of establishing a TCP connection with the gateway for data transmission when receiving a TCP connection establishment request returned by the gateway and the step of sending a message for closing the TCP connection to the gateway and disconnecting the TCP connection when detecting that data transmission is completed, the data transmission method further includes:
sending a heartbeat message request to the gateway;
and receiving the heartbeat message fed back by the gateway to keep TCP connection.
Optionally, when receiving a TCP connection establishment request returned by the gateway, before the step of establishing a TCP connection with the gateway for data transmission, the method further includes:
receiving an authentication request sent by the gateway;
determining an authentication check result according to the authentication request, and sending the authentication check result to the gateway;
and when the authentication and verification result is that the verification is successful, and when a TCP connection establishment request returned by the gateway is executed, establishing a TCP connection with the gateway for data transmission.
In addition, to achieve the above object, the present invention further provides a data transmission method, where the data transmission method is applied to a gateway, and the data transmission method includes:
when the change of the IP address is detected, generating IP address updating information according to the changed IP address;
sending the IP address updating information to the server so that the server can update the registered IP address of the corresponding gateway according to the IP address updating information;
when an HTTP GET request sent by the server is received, after a TCP connection establishment request is sent to the server, TCP connection is established with the server to carry out data transmission;
and when receiving a message for closing the TCP connection sent by the server, disconnecting the TCP connection.
Optionally, when detecting that the IP address changes, after the step of generating the IP address update information according to the changed IP address, the method further includes:
sending an HTTP POST request to the server through a TR069 channel and the event that the IP address changes;
and when receiving the information fed back according to the HTTP POST request, executing the step of sending the IP address updating information to the server.
Optionally, after sending the TCP connection establishment request to the server, before the step of establishing a TCP connection with the server for data transmission, the method further includes:
sending an authentication request to the server;
receiving an authentication check result fed back by the server;
and when the authentication and verification result is successful, the step of establishing TCP connection with the server for data transmission after the TCP connection establishment request is sent to the server is executed.
In addition, to achieve the above object, the present invention also provides a data transmission device, including:
the updating module is used for updating the registered IP address of the corresponding gateway according to the IP address updating information when the IP address updating information which contains the IP address of the gateway and is sent by the gateway is received;
the first sending module is used for sending an HTTP GET request to the gateway when detecting that data transmission exists;
the first receiving module is used for establishing TCP connection with the gateway to enter a data transmission state when receiving a TCP connection establishment request returned by the gateway;
the second sending module is used for sending a message for closing the TCP connection to the gateway and disconnecting the TCP connection when the completion of data transmission is detected; alternatively, the first and second electrodes may be,
the message generation module is used for generating IP address updating information according to the changed IP address when the change of the IP address is detected;
a third sending module, configured to send the IP address update information to the server, so that the server updates an IP address of a registered corresponding gateway according to the IP address update information;
the fourth sending module is used for sending a TCP connection establishment request to the server and then establishing a TCP connection with the server to perform data transmission when receiving the HTTP GET request sent by the server;
and the second receiving module is used for disconnecting the TCP connection when receiving the message for closing the TCP connection sent by the server.
In addition, to achieve the above object, the present invention further provides a data transmission device, including: a memory, a processor and a data transfer program stored in the memory and executable on the processor, the data transfer program when executed by the processor implementing the steps of the data transfer method as described above.
Furthermore, to achieve the above object, the present invention also provides a computer-readable storage medium having a data transmission program stored thereon, which when executed by the processor, implements the steps of the data transmission method as described above.
The server receives IP address update information sent by the gateway, updates the registered IP address of the corresponding gateway through the IP address of the gateway in the IP address update information, further obtains the IP address updated by the gateway in real time, can actively send an HTTP GET request to the gateway according to the registered IP address of the gateway when the server has data transmission, establishes TCP connection with the gateway to transmit data when receiving a TCP connection establishment request sent by the gateway, and sends a message for closing the TCP connection to the gateway and disconnects the TCP connection when detecting that the data transmission is finished, so that the data transmission is carried out by establishing the TCP connection between the server and the gateway when the server only has the data transmission, and the TCP connection is immediately disconnected when the data transmission does not exist, and the server and the gateway are not required to always keep a long connection channel for data transmission, thereby achieving the purposes of reducing the resource of the server, the network bandwidth and the pressure loaded by a firewall and saving performance.
Drawings
Fig. 1 is a schematic structural diagram of a data transmission apparatus according to various embodiments of a data transmission method of the present invention;
FIG. 2 is a schematic flow chart of a data transmission method applied to a server according to the present invention;
FIG. 3 is a flowchart illustrating a method for transmitting a hypertext transfer protocol request according to the present invention;
fig. 4 is an interaction diagram illustrating that a server actively initiates a gateway connection request to a gateway according to the latest IP address registered by the gateway, and the gateway interacts with the server;
fig. 5 is a schematic flow chart of the data transmission method applied to the gateway according to the present invention;
FIG. 6 is an interaction diagram illustrating interaction between a gateway and a server after the IP address of the gateway is changed;
FIG. 7 is an interaction diagram illustrating a gateway registering with a server;
FIG. 8 is an interaction process between a gateway and a server when there is data transmission and there is no data transmission in the server;
FIG. 9 is a schematic diagram of a first module of the data transmission apparatus;
fig. 10 is a second block diagram of the data transmission device.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
In the following description, suffixes such as "module", "part", or "unit" used to indicate elements are used only for facilitating the description of the present invention, and have no particular meaning in themselves. Thus, "module", "component" or "unit" may be used mixedly.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a data transmission device according to various embodiments of a data transmission method of the present invention. The data transmission device may be a server or a gateway.
As shown in fig. 1, the data transmission apparatus may include: memory 101, processor 102, and communication unit 103. It will be understood by those skilled in the art that the block diagram of the data transfer device shown in fig. 1 does not constitute a limitation of the data transfer device, and that the data transfer device may include more or less components than those shown, or combine some components, or a different arrangement of components. The memory 101 stores therein an operating system and a data transfer program. The processor 102 is a control center of the data transmission device, and the processor 102 executes the data transmission program stored in the memory 101 to implement the steps of the embodiments of the data transmission method of the present invention. The communication unit 103 establishes data communication (the data communication may be IP communication) with other devices, such as a terminal device, through a network protocol to implement data transmission with other devices, for example, when the data transmission device is a server, the server may establish data communication with a gateway through the network protocol through the communication unit 103 to implement data transmission between the server and the gateway, such as managing the gateway through the server.
It should be noted that, when the data transmission device is a server, the data transmission device is further Integrated with an Integrated Terminal Management System (ITMS) and a Terminal device access module, where the ITMS is mainly used for device registration, initial automatic configuration, remote fault diagnosis and repair, device monitoring, and the like of a home gateway, and the Terminal device access module is used for device access such as gateway access.
When the data transmission device is a server, the data transmission program in the memory 101 implements the following steps when executed by the processor 102:
when receiving IP address updating information which is sent by a gateway and contains the IP address of the gateway, updating the registered IP address of the corresponding gateway according to the IP address updating information;
when detecting that data transmission exists, sending an HTTP GET request to a gateway according to the IP address of the registered gateway;
when a TCP connection establishment request returned by the gateway is received, establishing TCP connection with the gateway for data transmission;
and when the data transmission is detected to be finished, sending a message for closing the TCP connection to the gateway, and disconnecting the TCP connection.
Correspondingly, when the data transmission device is a gateway, the data transmission program in the memory 101 implements the following steps when executed by the processor 102:
when the change of the IP address is detected, generating IP address updating information according to the changed IP address;
sending the IP address updating information to the server so that the server can update the registered IP address of the corresponding gateway according to the IP address updating information;
when an HTTP GET request sent by the server is received, after a TCP connection establishment request is sent to the server, TCP connection is established with the server to carry out data transmission;
and when receiving a message for closing the TCP connection sent by the server, disconnecting the TCP connection.
Based on the structural block diagram of the terminal device, various embodiments of the data transmission method of the present invention are proposed.
In an embodiment, the present invention provides a data transmission method, please refer to fig. 2, and fig. 2 is a schematic flow chart illustrating the application of the data transmission method in a server. In this embodiment, the data transmission method includes the steps of:
step S10, when receiving IP address updating information which is sent by a gateway and contains the IP address of the gateway, updating the registered IP address of the corresponding gateway according to the IP address updating information;
the IP address update information is update information generated according to the IP address of the gateway after the IP address of the gateway changes. The IP address updating information includes but is not limited to a gateway identifier and an IP address of the gateway, the gateway identifier is used for uniquely determining the gateway, and the IP address of the gateway is the current latest IP address after the gateway is updated in real time. Updating the IP address of the corresponding gateway which is registered according to the IP address updating information, namely updating the IP address of the gateway which is registered in the server through the IP address of the gateway in the IP address updating information to obtain the latest IP address of the gateway which is updated in real time, ensuring that the IP address of the gateway which is registered in the server is valid, automatically initiating a hypertext transfer protocol request by the server through the IP address of the gateway which is registered, waiting for receiving a TCP (transmission control protocol) connection establishment request initiated by the gateway, and establishing a TCP connection with the gateway for data transmission.
Step S20, when detecting that data transmission exists, sending an HTTP GET request to the gateway according to the IP address of the registered gateway;
the HTTP GET request is a request mode in a hypertext transfer protocol, and is a method for acquiring data. And sending an HTTP GET request to the gateway according to the IP address of the registered gateway so as to prepare to establish the TCP connection.
When data transmission is detected to exist, an HTTP GET request is sent to a gateway according to an IP address of a registered gateway, a target address of the data transmission to be transmitted may be obtained first, a target gateway in the data transmission process to be transmitted may be determined according to the target address, a target IP address of the target gateway may be determined from IP addresses of registered gateways of a server, and the HTTP GET request is sent to the target gateway according to the target IP address, which is not limited in this embodiment.
As an alternative implementation, referring to fig. 3, fig. 3 is a schematic flowchart of a data transmission method according to the present invention for sending a hypertext transfer protocol request, where the step S20 sending an HTTP GET request to a registered gateway according to an IP address of the gateway includes:
and step S21, sending an HTTP GET request to the gateway through the TR069 channel and the IP address of the registered gateway.
It should be noted that, in the practical application process, the gateway may be managed through a management platform of the server, the management platform may generally establish a TCP connection with the home gateway, and under a policy configured by an operator BRAS system, the home gateway may occasionally replace its own IP, which may make it difficult for the management platform to actively connect to the home gateway. In this embodiment, the integrated terminal management system in the server is further connected to another terminal such as a gateway through the TR069 channel, and the server sends an HTTP GET request to the gateway through the TR069 channel and the IP address of the registered gateway to prepare for establishing a TCP connection.
Step S30, when receiving a TCP connection establishment request returned by the gateway, establishing a TCP connection with the gateway for data transmission;
and step S40, when the data transmission is detected to be finished, sending a message for closing the TCP connection to the gateway, and disconnecting the TCP connection.
When a TCP connection establishment request returned by the gateway is received, the TCP connection is established with the gateway to carry out data transmission until the data transmission is finished, when the data transmission is detected to be finished, a message for closing the TCP connection is sent to the gateway and the TCP connection is disconnected, so that the TCP connection is established with the gateway under the condition that only the server has data transmission, and when the server does not have data transmission, the TCP connection is disconnected without needing the server and the gateway to always keep a long connection channel for carrying out data transmission, thereby achieving the purposes of reducing the server resources, the network bandwidth and the pressure loaded by a firewall and saving the energy consumption.
As an optional implementation manner, step S30 further includes, before:
receiving an authentication request sent by the gateway;
determining an authentication check result according to the authentication request, and sending the authentication check result to the gateway;
and executing step S30 when the authentication and verification result is that verification is successful.
In an actual application process, in order to ensure the security of the connection between the gateway and the server and improve the security of data transmission, the gateway may send an authentication request to the server, where the authentication request includes authentication information such as a password, a MAC address of the terminal, a serial number of the terminal, and the like. After the server side receives the authentication request, the server side can check according to authentication information in the authentication request to obtain an authentication check result, and when the authentication check result is successful, namely the authentication is passed, the server side indicates that the gateway and the server can be connected, and data transmission between the gateway and the server is safe.
For example, to facilitate understanding that the server actively initiates a gateway connection requirement to the gateway according to the latest IP address registered by the gateway, please refer to fig. 4, where fig. 4 is an interaction diagram illustrating that the server actively initiates a gateway connection requirement to the gateway according to the latest IP address registered by the gateway, and the gateway interacts with the server.
The concrete description is as follows:
1. the server has a data transmission requirement and acquires the latest IP address of the gateway from the stored IP addresses of the registered gateways;
2. informing the ITMS module of the requirement of connecting the gateway;
3. the ITMS module issues an HTTP GET request to a gateway based on a TR069 channel to prepare for establishing connection;
4. the gateway responds to the HTTP request;
5. the gateway initiates a TCP connection request to the server and transmits authentication information (mac, sn, password and the like);
6. the server verifies the authentication information;
7. the server returns authentication passing information to the gateway;
8. the gateway and the server complete the establishment of a TCP connection channel and keep alive through the timing heartbeat message;
9. the server and the gateway transmit data;
10. and after the server finishes the communication requirement of data transmission, actively closing the TCP connection.
As an optional implementation manner, the data transmission method further includes:
and when a heartbeat message request sent by the gateway is received, sending a heartbeat message corresponding to the heartbeat message request to the gateway.
The heartbeat message request may be used to detect whether a normal connection is maintained between the server and the gateway. When a heartbeat message request sent by the gateway is received, a heartbeat message corresponding to the heartbeat message request is sent to the gateway to inform the gateway, and the server and the gateway are normally connected and can continuously transmit data.
In the embodiment, the server updates the registered IP address of the corresponding gateway through the IP address of the gateway in the IP address updating information by receiving the IP address updating information sent by the gateway, so as to obtain the IP address updated by the gateway in real time, when the server has data transmission, the server can actively send an HTTP GET request to the gateway according to the registered IP address of the gateway, and establishes a TCP connection with the gateway for data transmission when receiving the TCP connection establishment request sent by the gateway, and sends a message for closing the TCP connection and disconnects the TCP connection to the gateway when detecting that the data transmission is finished, so that the server establishes the TCP connection with the gateway for data transmission when only the server has the data transmission, and immediately disconnects the TCP connection when the data transmission does not exist, and the server and the gateway are not required to always keep a long connection channel for data transmission, thereby achieving the purposes of reducing the pressure of server resources, network bandwidth and loads and saving energy consumption.
Further, it should be noted that, compared to the server and the gateway always keeping long connection, which results in long-term occupation of server resources and network bandwidth, in this embodiment, connection is actively established only when there is a data transmission communication requirement, and data transmission is immediately disconnected after completion, which can reduce a large number of TCP connections and greatly liberate the performance of the server itself. And because of the characteristics of the wide area network, the gateway connection server may pass through a multi-layer network, the TCP connection establishment request is firstly forwarded to a network firewall or other transfer servers, and when the number of TCP connections is reduced, the network bandwidth and the firewall pressure are also greatly released. In addition, by adding the TR069 channel, the server actively issues a hypertext transfer protocol request such as an HTTP GET request to the gateway through the TR069 channel and the IP address of the gateway, and the gateway sends a TCP connection establishment request to connect the server after receiving the HTTP GET request.
Correspondingly, referring to fig. 5, fig. 5 is a schematic flow chart illustrating the data transmission method of the present invention applied to a gateway. In this embodiment, the data transmission method includes the steps of:
step S50, when the change of the IP address is detected, generating IP address updating information according to the changed IP address;
step S60, the IP address updating information is sent to the server, so that the server can update the registered IP address of the corresponding gateway according to the IP address updating information;
the IP address update information is update information generated according to the IP address of the gateway after the IP address of the gateway changes. The IP address updating information includes but is not limited to a gateway identifier and an IP address of the gateway, the gateway identifier is used for uniquely determining the gateway, and the IP address of the gateway is the current latest IP address after the gateway is updated in real time.
As an optional implementation manner, step S50 is followed by:
sending an HTTP POST request to the server through a TR069 channel and the event that the IP address changes;
and when receiving the information fed back according to the HTTP POST request, executing the step S60.
The HTTP POST request is a request mode in a hypertext transfer protocol, and is a method for sending data.
It should be noted that, in the practical application process, the gateway may be managed through a management platform of the server, the management platform may generally establish a TCP connection with the home gateway, and under a policy configured by an operator BRAS system, the home gateway may occasionally replace its own IP, which may make it difficult for the management platform to actively connect to the home gateway. In this embodiment, through a terminal integrated management system in a server, the terminal integrated management system is further connected to another terminal, such as a gateway, through a TR069 channel, so that when an IP address of the gateway changes, IP address update information is generated according to the IP address after the gateway changes, and further an HTTP POST request is sent to the server through the TR069 channel and an event that the IP address of the gateway changes, wherein after receiving information fed back by the server according to the HTTP POST request, step S60 is executed, that is, IP address update information is sent to the server, so that the server updates the registered IP address of the corresponding gateway according to the IP address update information.
For example, to facilitate understanding of the interaction flow between the server and the gateway after the IP address of the gateway is changed, please refer to fig. 6, and fig. 6 is an interaction diagram illustrating the interaction between the gateway and the server after the IP address of the gateway is changed. The concrete description is as follows:
after detecting that the IP address changes, the gateway sends an HTTP(s) POST request to an ITMS module in the server through a TR069 channel;
the ITMS module responds to HTTP(s) Response;
the gateway sends the latest parameters including the current latest IP address of the gateway;
the ITMS module receives the request and informs the server to update the gateway information;
and finishing the interactive notification.
Step S70, when receiving the HTTP GET request sent by the server, after sending a TCP connection establishment request to the server, establishing a TCP connection with the server for data transmission;
and step S80, when receiving the message of closing the TCP connection sent by the server, disconnecting the TCP connection.
The method comprises the steps of receiving an HTTP GET request sent by a server, namely receiving a TCP connection establishment request signal sent by the server, sending a TCP connection establishment request to the server, then establishing TCP connection with the server to carry out data transmission until receiving a message for closing the TCP connection sent by the server, namely when the server does not have data transmission, disconnecting the TCP connection, and achieving the purposes of reducing the pressure loaded by server resources, network bandwidth and a firewall and saving performance consumption.
As an optional implementation manner, between step S70 and step S80, the data transmission method further includes:
sending a heartbeat message request to the server;
and receiving the heartbeat message fed back by the server to keep TCP connection.
The heartbeat message request may be used to detect whether a normal connection is maintained between the server and the gateway. In the actual application process, signal interference may exist in the connection process between the server and the gateway to cause abnormal connection between the server and the gateway, and by means of sending a heartbeat message request to the server, if a heartbeat message corresponding to the heartbeat message request fed back by the server can be received, it is indicated that the connection between the server and the gateway is normal, so as to keep the TCP connection to perform data transmission.
Optionally, the heartbeat message request may be sent to the server at a fixed time, or at a preset time interval, which is not limited herein.
As an alternative embodiment, in an actual application process, please refer to fig. 7, and fig. 7 is an interaction diagram illustrating that a gateway registers with a server. When the gateway is connected with the server for the first time, the gateway needs to send a registration request to the server, and after the server receives the registration request sent by the gateway, the data verification of the registration request is completed, and a response result is returned. Optionally, the response result may include an agreed period negotiation parameter, where the period negotiation parameter is used to determine the time or time period when the gateway initiates the registration request, that is, the silent period, and the period negotiation parameter may be preset. If the period negotiation parameter can be set as the registration request initiated by the gateway every 6 hours by default, the server can modify the time set by the period negotiation parameter through parameter configuration. If the server determines that the gateway is on-line, the on-line state of the gateway can be updated, a registration result response is sent to the gateway to inform the gateway of successful registration, and the IP address of the registered gateway is stored at the server side.
As an optional implementation manner, after the step S70 sends the TCP connection establishment request to the server, before establishing a TCP connection with the server for data transmission, the method further includes:
sending an authentication request to the server;
receiving an authentication check result fed back by the server;
and when the authentication and verification result is that verification is successful, the step of establishing a TCP connection with the server to perform data transmission after sending a TCP connection establishment request to the server in step S70 is performed.
In an actual application process, in order to ensure the security of the connection between the gateway and the server and improve the security of data transmission, the gateway may send an authentication request to the server, where the authentication request includes authentication information such as a password, a MAC address of the terminal, and a serial number of the terminal. After receiving the authentication request, the server side can check according to authentication information in the authentication request to obtain an authentication check result, and sends the authentication check result to the gateway, so that when the gateway receives the authentication check result and determines that the authentication check result is successful, namely the authentication is passed, the gateway and the server can establish connection, data transmission between the gateway and the server is safe, and after sending a TCP connection establishment request to the server, TCP connection is established with the server to enter a data transmission state.
For example, to facilitate understanding in this embodiment, when receiving a TCP connection establishment request sent by a gateway, a server establishes a TCP connection with the gateway for data transmission, and when detecting that data transmission is completed, sends a message for closing the TCP connection to the gateway and disconnects the TCP connection, so that a specific process that the server establishes the TCP connection with the gateway for data transmission only when there is data transmission in the server, and immediately disconnects the TCP connection when there is no data transmission in the server is realized, please refer to fig. 8, where fig. 8 is an interaction process between the gateway and the server when there is data transmission and there is no data transmission in the server, and the specific description is as follows:
1. the gateway initiates a TCP connection establishment request to a server;
2. the server authenticates the gateway information;
3. returning response information after the authentication is successful;
4. the server checks whether a long connection needs to be maintained according to service needs such as data transmission needs;
5. if no service requirement exists, closing the TCP connection;
6. if the TCP connection needs to be kept, the gateway needs to be informed to send a heartbeat request regularly to maintain the long TCP connection;
7. the gateway sends a heartbeat request at regular time, and if the heartbeat request is sent once in default 10 minutes;
8. the gateway and the server carry out data interactive transmission;
9. the server completes the service requirement and checks whether the TCP long connection needs to be closed;
10. if no service requirement exists, closing the TCP connection;
11. if the heartbeat message needs to be kept, the heartbeat message is kept.
In the technical scheme disclosed in this embodiment, when detecting that an IP address changes, a gateway sends an IP address update message generated by an IP address including the changed gateway to a server, so that the server updates the registered IP address of a corresponding gateway according to the IP address update message, and further obtains the IP address updated by the gateway in real time.
Referring to fig. 9, fig. 9 is a schematic diagram of a first module of a data transmission apparatus, the invention further provides a data transmission apparatus 100, where the data transmission apparatus 100 includes:
an updating module 110, configured to update a registered IP address of a corresponding gateway according to IP address update information when receiving the IP address update information that includes the IP address of the gateway and is sent by the gateway;
a first sending module 120, configured to send an HTTP GET request to the gateway when detecting that there is data transmission;
a first receiving module 130, configured to establish a TCP connection with the gateway to enter a data transmission state when receiving a TCP connection establishment request returned by the gateway;
a second sending module 140, configured to send a message for closing the TCP connection to the gateway and disconnect the TCP connection when detecting that data transmission is completed; alternatively, the first and second electrodes may be,
referring to fig. 10, fig. 10 is a schematic diagram of a second module of a data transmission device, and the invention further provides a data transmission device 100, where the data transmission device 100 includes:
a message generating module 150, configured to generate IP address update information according to the changed IP address when detecting that the IP address changes;
a third sending module 160, configured to send the IP address update information to the server, so that the server updates the IP address of the registered corresponding gateway according to the IP address update information;
a fourth sending module 170, configured to, when receiving the HTTP GET request sent by the server, send a TCP connection establishment request to the server, and establish a TCP connection with the server to perform data transmission;
the second receiving module 180 is configured to disconnect the TCP connection when receiving a message that the server sends a message for closing the TCP connection.
The invention also provides a data transmission device, comprising: the data transmission method comprises a memory, a processor and a data transmission program which is stored in the memory and can run on the processor, wherein the data transmission program realizes the steps of the data transmission method in any one of the embodiments when being executed by the processor.
The present invention also proposes a computer-readable storage medium having stored thereon a data transmission program which, when executed by a processor, implements the steps of the data transmission method according to any one of the above embodiments.
In the embodiments of the terminal device and the computer-readable storage medium provided by the present invention, all technical features of the embodiments of the data transmission method are included, and the contents of expansion and explanation of the specification are substantially the same as those of the embodiments of the data transmission method, and are not described herein again.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent structures or equivalent processes performed by the present invention or directly or indirectly applied to other related technical fields are also included in the scope of the present invention.

Claims (10)

1. A data transmission method is applied to a server, and the data transmission method comprises the following steps:
when receiving IP address updating information which is sent by a gateway and contains the IP address of the gateway, updating the registered IP address of the corresponding gateway according to the IP address updating information;
when detecting that data transmission exists, sending an HTTP GET request to a gateway according to the IP address of the registered gateway;
when a TCP connection establishment request returned by the gateway is received, establishing TCP connection with the gateway for data transmission;
and when the data transmission is detected to be finished, sending a message for closing the TCP connection to the gateway, and disconnecting the TCP connection.
2. The data transmission method according to claim 1, wherein the step of sending an HTTP GET request to the gateway according to the IP address of the registered gateway comprises:
an HTTP GET request is sent to the gateway over the TR069 channel and the IP address of the registered gateway.
3. The data transmission method according to claim 1, wherein before the step of establishing a TCP connection with the gateway for data transmission when receiving the TCP connection establishment request returned by the gateway, the method further comprises:
receiving an authentication request sent by the gateway;
determining an authentication check result according to the authentication request, and sending the authentication check result to the gateway;
and when the authentication and verification result is that the verification is successful, and a TCP connection establishment request returned by the gateway is executed, establishing a TCP connection with the gateway to perform data transmission.
4. A data transmission method is applied to a gateway, and the data transmission method comprises the following steps:
when the change of the IP address is detected, generating IP address updating information according to the changed IP address;
sending the IP address updating information to a server so that the server can update the registered IP address of the corresponding gateway according to the IP address updating information;
when an HTTP GET request sent by the server is received, after a TCP connection establishment request is sent to the server, TCP connection is established with the server to carry out data transmission;
and when receiving a message for closing the TCP connection sent by the server, disconnecting the TCP connection.
5. The data transmission method according to claim 4, wherein between the step of establishing a TCP connection with the server for data transmission after the step of transmitting a TCP connection establishment request to the server when receiving the HTTP GET request transmitted from the server and the step of disconnecting the TCP connection when receiving a message for closing the TCP connection transmitted from the server, the data transmission method further comprises:
sending a heartbeat message request to the server;
and receiving the heartbeat message fed back by the server to keep TCP connection.
6. The data transmission method according to claim 4, wherein after the step of generating the IP address update information according to the changed IP address when detecting that the IP address is changed, the method further comprises:
sending an HTTP POST request to the server through a TR069 channel and the event that the IP address changes;
and when receiving the information fed back according to the HTTP POST request, executing the step of sending the IP address updating information to the server.
7. The data transmission method according to claim 4, wherein after the step of sending the TCP connection establishment request to the server, before the step of establishing a TCP connection with the server for data transmission, the method further comprises:
sending an authentication request to the server;
receiving an authentication check result fed back by the server;
and when the authentication and verification result is successful, the step of establishing TCP connection with the server for data transmission after the TCP connection establishment request is sent to the server is executed.
8. A data transmission apparatus, characterized in that the data transmission apparatus comprises:
the updating module is used for updating the registered IP address of the corresponding gateway according to the IP address updating information when the IP address updating information which contains the IP address of the gateway and is sent by the gateway is received;
the first sending module is used for sending an HTTP GET request to the gateway when detecting that data transmission exists;
the first receiving module is used for establishing TCP connection with the gateway to enter a data transmission state when receiving a TCP connection establishment request returned by the gateway;
the second sending module is used for sending a message for closing the TCP connection to the gateway and disconnecting the TCP connection when the completion of data transmission is detected; alternatively, the first and second electrodes may be,
the message generation module is used for generating IP address updating information according to the changed IP address when the change of the IP address is detected;
a third sending module, configured to send the IP address update information to a server, so that the server updates an IP address of a registered corresponding gateway according to the IP address update information;
the fourth sending module is used for sending a TCP connection establishment request to the server and then establishing a TCP connection with the server to perform data transmission when receiving the HTTP GET request sent by the server;
and the second receiving module is used for disconnecting the TCP connection when receiving the message for closing the TCP connection sent by the server.
9. A data transmission apparatus, characterized in that the data transmission apparatus comprises: a memory, a processor and a data transfer program stored in the memory and executable on the processor, the data transfer program when executed by the processor implementing the steps of the data transfer method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a data transmission program which, when executed by a processor, implements the steps of the data transmission method according to any one of claims 1 to 4 or the steps of the data transmission method according to any one of claims 5 to 7.
CN202110884741.0A 2021-08-02 2021-08-02 Data transmission method, device and computer readable storage medium Active CN113691591B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110884741.0A CN113691591B (en) 2021-08-02 2021-08-02 Data transmission method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110884741.0A CN113691591B (en) 2021-08-02 2021-08-02 Data transmission method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113691591A CN113691591A (en) 2021-11-23
CN113691591B true CN113691591B (en) 2022-12-27

Family

ID=78578897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110884741.0A Active CN113691591B (en) 2021-08-02 2021-08-02 Data transmission method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113691591B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114401167A (en) * 2022-01-28 2022-04-26 中智城信息科技(苏州)有限公司 Data transmission method and device for edge gateway and cloud server

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3198939A1 (en) * 2014-09-25 2017-08-02 Nokia Solutions and Networks Oy Tcp connection establishment and handover
CN109347966A (en) * 2018-10-31 2019-02-15 许继集团有限公司 A kind of server cluster means of communication and terminal device and communication server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102395119B (en) * 2011-11-15 2014-11-19 华为技术有限公司 Method for supporting permanent online of application client, system and apparatus thereof
CN111935656B (en) * 2020-07-24 2021-12-14 深圳市沃特沃德软件技术有限公司 Method and device for long connection of IP data and computer equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3198939A1 (en) * 2014-09-25 2017-08-02 Nokia Solutions and Networks Oy Tcp connection establishment and handover
CN109347966A (en) * 2018-10-31 2019-02-15 许继集团有限公司 A kind of server cluster means of communication and terminal device and communication server

Also Published As

Publication number Publication date
CN113691591A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
EP3726806B1 (en) Method for remotely controlling vehicle on the basis of smart apparatus
EP2645636B1 (en) Home gateway, cloud server, and method for communication therebetween
JP5364671B2 (en) Terminal connection status management in network authentication
EP2978144B1 (en) Unified device management method and system
KR101371057B1 (en) Relay communication system and access management apparatus
CN101345741A (en) Proxy system and proxy connecting method based on internet
CN111741538B (en) Communication link establishing method based on gateway, equipment control method and device
WO2015078341A1 (en) Method and device for remotely updating application program
CN107835257B (en) Session management method and device
CN114422571B (en) Quantum communication client disconnection reconnection system and method
US9417887B2 (en) Method and apparatus for bootstrapping gateway in device management system
CN113691591B (en) Data transmission method, device and computer readable storage medium
CN103685398A (en) Communication connection establishment method and communication system
WO2013189398A2 (en) Application data push method, device, and system
WO2018095341A1 (en) Method and apparatus for executing transfer policy, and computer-readable storage medium
EP1593230B1 (en) Terminating a session in a network
CN101699905A (en) Wireless intelligent terminal, webmaster platform and management method by webmaster platform
CN101102234A (en) Control method and system for preventing from network camera monitoring
CN103718510A (en) Remote management of devices
US9042382B1 (en) Application update using multiple disparate networks
US11212160B2 (en) Remote control of equipment
US11528338B2 (en) Methods, systems, and computer readable media for providing for reliable service based interface (SBI) message transport using zero event notification messages
CN116094821B (en) Route configuration method and device
CN114338633B (en) Method and system for remotely connecting Linux server
JP2002218145A (en) Facsimile system

Legal Events

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