[go: up one dir, main page]

CN118075331A - Method, device, equipment and storage medium for establishing network access channel - Google Patents

Method, device, equipment and storage medium for establishing network access channel Download PDF

Info

Publication number
CN118075331A
CN118075331A CN202410210935.6A CN202410210935A CN118075331A CN 118075331 A CN118075331 A CN 118075331A CN 202410210935 A CN202410210935 A CN 202410210935A CN 118075331 A CN118075331 A CN 118075331A
Authority
CN
China
Prior art keywords
address
network
client
signaling server
terminal device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410210935.6A
Other languages
Chinese (zh)
Inventor
戴敏智
陈海峰
沈冬冬
牛冠杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
China Unicom Online Information Technology Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
China Unicom Online 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 United Network Communications Group Co Ltd, China Unicom Online Information Technology Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202410210935.6A priority Critical patent/CN118075331A/en
Publication of CN118075331A publication Critical patent/CN118075331A/en
Pending legal-status Critical Current

Links

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/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/54Presence management, e.g. monitoring or registration for receipt of user log-on information, or the connection status of the users
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/562Brokering proxy services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The method, the device, the equipment and the storage medium for establishing the network access channel are applied to the field of Internet communication. When detecting the change of the IP address of the terminal equipment, the terminal equipment firstly generates a new address instruction and sends the new address instruction to the proxy server through the signaling server so that the proxy server can update the stored IP address in time, then when determining that the client is in a starting state, the proxy server updates the second address memory of the client, and finally when determining that the current network environment of the client is a mobile network environment, the proxy server and the signaling server cooperatively construct a network access channel. The method solves the problems that the MQTT protocol in the prior art depends on a proxy server to transmit data, violates a local storage principle, increases information leakage risk and lacks a flexible adaptation mechanism when a network environment is switched, and further improves the efficiency and stability of network communication, thereby providing smoother network experience for users.

Description

网络访问通道的建立方法、装置、设备和存储介质Method, device, equipment and storage medium for establishing network access channel

技术领域Technical Field

本申请涉及互联网通讯领域,尤其涉及一种网络访问通道的建立方法、装置、设备和存储介质。The present application relates to the field of Internet communications, and in particular to a method, device, equipment and storage medium for establishing a network access channel.

背景技术Background technique

随着科技的快速发展和人们生活水平的提高,家庭和办公场所对于终端设备的智能化需求日益增强,甚至对部分终端设备(如智能电视、智能音箱、智能打印机等)要求具备智能化操作系统。因此,为了满足复杂的业务场景需求,如文件传输和视频资源本地播放时,MQTT协议被广泛采用,以实现客户端与终端设备之间的数据传输。With the rapid development of science and technology and the improvement of people's living standards, the demand for intelligent terminal devices in homes and offices is increasing, and some terminal devices (such as smart TVs, smart speakers, smart printers, etc.) are even required to have intelligent operating systems. Therefore, in order to meet the needs of complex business scenarios, such as file transfer and local playback of video resources, the MQTT protocol is widely used to achieve data transmission between clients and terminal devices.

然而,在处理复杂业务场景中,MQTT协议需要依赖代理服务器来实现终端设备与客户端之间的数据传输,这种中转机制并不符合用户信息本地存储的原则,从而增加了信息泄露的风险。此外,通过代理服务器传输资源不仅加重了服务器的带宽和存储负担,还提高了运营成本。更为关键的是,在局域网与其他网络环境之间切换时,由于缺乏灵活的网络适配机制,客户端与终端设备之间的网络访问方式难以灵活调整,这在一定程度上限制了MQTT协议在复杂网络环境下的应用范围和效率。However, when dealing with complex business scenarios, the MQTT protocol needs to rely on proxy servers to achieve data transmission between terminal devices and clients. This transit mechanism does not conform to the principle of local storage of user information, thereby increasing the risk of information leakage. In addition, transmitting resources through proxy servers not only increases the bandwidth and storage burden of the server, but also increases operating costs. More importantly, when switching between the LAN and other network environments, due to the lack of a flexible network adaptation mechanism, the network access method between the client and the terminal device is difficult to flexibly adjust, which to a certain extent limits the application scope and efficiency of the MQTT protocol in complex network environments.

因此,针对现有技术中MQTT协议依赖代理服务器传输数据、违反本地存储原则、增加信息泄露风险,以及在网络环境切换时缺乏灵活适配机制的问题,亟需提出有效的解决方案。Therefore, it is urgent to propose an effective solution to the problems in the existing technology that the MQTT protocol relies on proxy servers to transmit data, violates the local storage principle, increases the risk of information leakage, and lacks a flexible adaptation mechanism when switching network environments.

发明内容Summary of the invention

本申请提供一种网络访问通道的建立方法、装置、设备和存储介质,用以解决现有技术中MQTT协议依赖代理服务器传输数据、违反本地存储原则、增加信息泄露风险,以及在网络环境切换时缺乏灵活适配机制的问题。The present application provides a method, apparatus, device and storage medium for establishing a network access channel, which are used to solve the problems in the prior art that the MQTT protocol relies on a proxy server to transmit data, violates the local storage principle, increases the risk of information leakage, and lacks a flexible adaptation mechanism when switching network environments.

第一方面,本申请提供一种网络访问通道的建立方法,应用于终端设备,该方法包括:In a first aspect, the present application provides a method for establishing a network access channel, which is applied to a terminal device, and the method includes:

获取终端设备的局域网络信息,所述局域网络信息包括:IP地址;Acquire local area network information of the terminal device, the local area network information including: IP address;

实时检测所述IP地址是否发生改变,并在所述IP地址发生改变时,确定所述终端设备的新的IP地址;Detect in real time whether the IP address has changed, and when the IP address has changed, determine a new IP address of the terminal device;

根据所述新的IP地址,生成变更地址指令,并将所述变更地址指令发送至信令服务器,以使所述信令服务器将所述变更地址指令转发至代理服务器;Generate an address change instruction according to the new IP address, and send the address change instruction to the signaling server, so that the signaling server forwards the address change instruction to the proxy server;

获取所述信令服务器发送的远程访问地址,并根据所述远程访问地址,建立网络访问通道。Acquire the remote access address sent by the signaling server, and establish a network access channel according to the remote access address.

可选的,所述获取终端设备的局域网络信息之前,所述方法还包括:Optionally, before obtaining the local area network information of the terminal device, the method further includes:

获取终端设备的第一运行状态,并在所述目标运行状态为第一启动状态时,启动HTTP接口服务,以及向所述信令服务器发送第一连接请求,以使所述信令服务器根据所述第一连接请求,建立第一MQTT连接关系。Acquire a first operating state of the terminal device, and when the target operating state is a first startup state, start the HTTP interface service, and send a first connection request to the signaling server, so that the signaling server establishes a first MQTT connection relationship according to the first connection request.

可选的,所述根据所述远程访问地址,建立网络访问通道之后,所述方法还包括:Optionally, after establishing the network access channel according to the remote access address, the method further includes:

开启网络访问通道以及访问计时器,并对所述访问计时器的计时时长进行更新处理,所述访问计时器用于对网络访问通道的开启时长进行记录;Opening a network access channel and an access timer, and updating the timing of the access timer, wherein the access timer is used to record the opening duration of the network access channel;

判断所述访问计时器的当前计时时长是否为预设空闲超时时长;Determine whether the current timing duration of the access timer is a preset idle timeout duration;

若是,则关闭所述网络访问通道;If yes, closing the network access channel;

若否,则判断所述当前计时时长是否达到预设使用时长,所述预设空闲超时时长小于所述预设使用时长;If not, determining whether the current timing duration reaches the preset usage duration, and the preset idle timeout duration is less than the preset usage duration;

在所述当前计时时长达到预设使用时长时,关闭所述网络访问通道。When the current timing duration reaches the preset usage duration, the network access channel is closed.

第二方面,本申请提供一种网络访问通道的建立方法,应用于代理服务器,该方法包括:In a second aspect, the present application provides a method for establishing a network access channel, which is applied to a proxy server, and the method includes:

获取信令服务器发送的变更地址指令,并根据所述变更地址指令,对所述代理服务器的第一地址存储器进行更新处理;Obtaining an address change instruction sent by a signaling server, and updating a first address memory of the proxy server according to the address change instruction;

获取客户端发送的目标查询信息,并根据所述目标查询信息和所述第一地址存储器,确定目标查询结果;Acquire target query information sent by the client, and determine the target query result according to the target query information and the first address memory;

将所述目标查询结果发送至所述信令服务器,以使所述信令服务器将所述目标查询结果转发至所述客户端;Sending the target query result to the signaling server so that the signaling server forwards the target query result to the client;

获取所述客户端发送的网络通道创建指令,并根据所述网络通道创建指令,生成远程访问地址;Obtaining a network channel creation instruction sent by the client, and generating a remote access address according to the network channel creation instruction;

将所述远程访问地址发送至所述信令服务器,以使所述信令服务器将所述远程访问地址分别转发至所述终端设备和所述客户端。The remote access address is sent to the signaling server, so that the signaling server forwards the remote access address to the terminal device and the client respectively.

第三方面,本申请提供一种网络访问通道的建立方法,应用于客户端,该方法包括:In a third aspect, the present application provides a method for establishing a network access channel, which is applied to a client, and the method includes:

获取客户端的第二运行状态,并在所述第二运行状态为第二启动状态时,向所述代理服务器发送目标查询信息,以及向信令服务器发送第二连接请求,以使所述信令服务器根据所述第二连接请求,建立第二MQTT连接关系;Acquire a second running state of the client, and when the second running state is a second startup state, send target query information to the proxy server, and send a second connection request to the signaling server, so that the signaling server establishes a second MQTT connection relationship according to the second connection request;

获取所述信令服务器发送的目标查询结果,并根据所述目标查询结果,对所述客户端的第二地址存储器进行更新处理;Obtaining the target query result sent by the signaling server, and updating the second address memory of the client according to the target query result;

获取所述客户端的当前网络环境,并在所述当前网络环境为移动网络环境时,根据所述移动网络环境,生成网络通道创建指令;Acquire the current network environment of the client, and when the current network environment is a mobile network environment, generate a network channel creation instruction according to the mobile network environment;

将所述网络通道创建指令发送至所述代理服务器,以使代理服务器根据所述网络通道创建指令,建立网络访问通道。The network channel creation instruction is sent to the proxy server, so that the proxy server establishes a network access channel according to the network channel creation instruction.

可选的,所述方法还包括:Optionally, the method further includes:

在所述当前网络环境为Wi-Fi网络环境时,采用目标检测方式对所述第二地址存储器进行检测处理,得到目标检测结果,所述目标检测结果用于指示所述客户端和所述终端设备是否处于同一局域网络内;When the current network environment is a Wi-Fi network environment, a target detection method is used to detect the second address memory to obtain a target detection result, where the target detection result is used to indicate whether the client and the terminal device are in the same local area network;

在所述地址检测结果指示所述客户端和所述终端设备不处于同一局域网络内时,根据所述Wi-Fi网络环境,生成所述网络通道创建指令。When the address detection result indicates that the client and the terminal device are not in the same local area network, the network channel creation instruction is generated according to the Wi-Fi network environment.

可选的,所述根据所述当前网络环境,生成所述网络通道创建指令之后,所述方法还包括:Optionally, after generating the network channel creation instruction according to the current network environment, the method further includes:

获取所述信令服务器发送的远程访问地址,并对所述远程访问地址进行存储处理,以使所述客户端根据所述远程访问地址,对所述终端设备进行远程访问。The remote access address sent by the signaling server is obtained, and the remote access address is stored and processed, so that the client can remotely access the terminal device according to the remote access address.

第四方面,本申请提供一种网络访问通道的建立装置,应用于终端设备,该装置包括:In a fourth aspect, the present application provides a device for establishing a network access channel, which is applied to a terminal device, and the device includes:

获取模块,用于获取终端设备的局域网络信息,所述局域网络信息包括:IP地址;An acquisition module is used to acquire local area network information of a terminal device, wherein the local area network information includes: an IP address;

检测模块,用于实时检测所述IP地址是否发生改变;A detection module, used to detect in real time whether the IP address has changed;

确定模块,用于在所述IP地址发生改变时,确定所述终端设备的新的IP地址;A determination module, used to determine a new IP address of the terminal device when the IP address changes;

生成模块,用于根据所述新的IP地址,生成变更地址指令;A generating module, used for generating an address change instruction according to the new IP address;

发送模块,用于将所述变更地址指令发送至信令服务器,以使所述信令服务器将所述变更地址指令转发至代理服务器;A sending module, used for sending the change address instruction to a signaling server, so that the signaling server forwards the change address instruction to a proxy server;

所述获取模块,还用于获取所述信令服务器发送的远程访问地址;The acquisition module is further used to acquire the remote access address sent by the signaling server;

所述建立模块,用于根据所述远程访问地址,建立网络访问通道。The establishing module is used to establish a network access channel according to the remote access address.

可选的,所述获取模块,还用于获取终端设备的第一运行状态;Optionally, the acquisition module is further used to acquire the first operating state of the terminal device;

所述装置还包括:启动模块;The device also includes: a starting module;

所述启动模块,用于并在所述目标运行状态为第一启动状态时,启动HTTP接口服务;The startup module is used to start the HTTP interface service when the target running state is the first startup state;

所述发送模块,还用于在所述目标运行状态为所述第一启动状态时,向所述信令服务器发送第一连接请求,以使所述信令服务器根据所述第一连接请求,建立第一MQTT连接关系。The sending module is further configured to send a first connection request to the signaling server when the target running state is the first startup state, so that the signaling server establishes a first MQTT connection relationship according to the first connection request.

可选的,所述装置还包括:开启模块;Optionally, the device further comprises: an opening module;

所述开启模块,用于开启网络访问通道以及访问计时器;The opening module is used to open the network access channel and the access timer;

所述装置还包括:处理模块;The device further comprises: a processing module;

所述处理模块,用于对所述访问计时器的计时时长进行更新处理,所述访问计时器用于对网络访问通道的开启时长进行记录;The processing module is used to update the timing duration of the access timer, and the access timer is used to record the opening duration of the network access channel;

所述装置还包括:判断模块;The device further comprises: a judgment module;

所述判断模块,用于判断所述访问计时器的当前计时时长是否为预设空闲超时时长;The judging module is used to judge whether the current timing duration of the access timer is a preset idle timeout duration;

所述装置还包括:关闭模块;The device further comprises: a closing module;

所述关闭模块,用于在所述访问计时器的当前计时时长为预设空闲超时时长时,关闭所述网络访问通道;The closing module is used to close the network access channel when the current timing duration of the access timer is a preset idle timeout duration;

所述判断模块,还用于在所述访问计时器的当前计时时长不为预设空闲超时时长时,判断所述当前计时时长是否达到预设使用时长,所述预设空闲超时时长小于所述预设使用时长;The judging module is further configured to judge, when the current timing duration of the access timer is not the preset idle timeout duration, whether the current timing duration reaches the preset usage duration, and the preset idle timeout duration is less than the preset usage duration;

所述关闭模块,还用于在所述当前计时时长达到预设使用时长时,关闭所述网络访问通道。The closing module is further configured to close the network access channel when the current timing duration reaches a preset usage duration.

第五方面,本申请提供一种网络访问通道的建立装置,应用于代理服务器,该装置包括:In a fifth aspect, the present application provides a device for establishing a network access channel, which is applied to a proxy server, and the device includes:

获取模块,用于获取信令服务器发送的变更地址指令;An acquisition module, used to acquire an address change instruction sent by a signaling server;

处理模块,用于根据所述变更地址指令,对所述代理服务器的第一地址存储器进行更新处理;A processing module, used for updating the first address storage of the proxy server according to the address change instruction;

所述获取模块,还用于获取客户端发送的目标查询信息;The acquisition module is also used to acquire the target query information sent by the client;

确定模块,用于根据所述目标查询信息和所述第一地址存储器,确定目标查询结果;A determination module, configured to determine a target query result according to the target query information and the first address memory;

发送模块,用于将所述目标查询结果发送至所述信令服务器,以使所述信令服务器将所述目标查询结果转发至所述客户端;A sending module, used for sending the target query result to the signaling server, so that the signaling server forwards the target query result to the client;

所述获取模块,还用于获取所述客户端发送的网络通道创建指令;The acquisition module is further used to acquire the network channel creation instruction sent by the client;

生成模块,用于根据所述网络通道创建指令,生成远程访问地址;A generating module, used for generating a remote access address according to the network channel creation instruction;

所述发送模块,还用于将所述远程访问地址发送至所述信令服务器,以使所述信令服务器将所述远程访问地址分别转发至所述终端设备和所述客户端。The sending module is further used to send the remote access address to the signaling server, so that the signaling server forwards the remote access address to the terminal device and the client respectively.

第六方面,本申请提供一种网络访问通道的建立装置,应用于客户端,该装置包括:In a sixth aspect, the present application provides a device for establishing a network access channel, which is applied to a client, and the device includes:

获取模块,用于获取客户端的第二运行状态;An acquisition module, used for acquiring a second running state of the client;

发送模块,用于在所述第二运行状态为第二启动状态时,向所述代理服务器发送目标查询信息,以及向信令服务器发送第二连接请求,以使所述信令服务器根据所述第二连接请求,建立第二MQTT连接关系;A sending module, configured to send target query information to the proxy server and send a second connection request to the signaling server when the second operating state is a second startup state, so that the signaling server establishes a second MQTT connection relationship according to the second connection request;

所述获取模块,还用于获取所述信令服务器发送的目标查询结果;The acquisition module is further used to obtain the target query result sent by the signaling server;

处理模块,用于根据所述目标查询结果,对所述客户端的第二地址存储器进行更新处理;A processing module, used for updating the second address storage of the client according to the target query result;

所述获取模块,还用于获取所述客户端的当前网络环境;The acquisition module is further used to acquire the current network environment of the client;

生成模块,用于在所述当前网络环境为移动网络环境时,根据所述移动网络环境,生成网络通道创建指令;A generating module, configured to generate a network channel creation instruction according to the mobile network environment when the current network environment is a mobile network environment;

发送模块,还用于将所述网络通道创建指令发送至所述代理服务器,以使代理服务器根据所述网络通道创建指令,建立网络访问通道。The sending module is also used to send the network channel creation instruction to the proxy server, so that the proxy server establishes a network access channel according to the network channel creation instruction.

可选的,所述处理模块,还用于在所述当前网络环境为Wi-Fi网络环境时,采用目标检测方式对所述第二地址存储器进行检测处理,得到目标检测结果,所述目标检测结果用于指示所述客户端和所述终端设备是否处于同一局域网络内;Optionally, the processing module is further configured to, when the current network environment is a Wi-Fi network environment, use a target detection method to perform detection processing on the second address memory to obtain a target detection result, wherein the target detection result is used to indicate whether the client and the terminal device are in the same local area network;

所述生成模块,还用于在所述地址检测结果指示所述客户端和所述终端设备不处于同一局域网络内时,根据所述Wi-Fi网络环境,生成所述网络通道创建指令。The generating module is further configured to generate the network channel creating instruction according to the Wi-Fi network environment when the address detection result indicates that the client and the terminal device are not in the same local area network.

可选的,所述获取模块,还用于获取所述信令服务器发送的远程访问地址;Optionally, the acquisition module is further used to acquire the remote access address sent by the signaling server;

所述处理模块,还用于对所述远程访问地址进行存储处理,以使所述客户端根据所述远程访问地址,对所述终端设备进行远程访问。The processing module is further used to store and process the remote access address so that the client can remotely access the terminal device according to the remote access address.

第七方面,本申请提供一种网络访问通道的建立设备,包括:In a seventh aspect, the present application provides a device for establishing a network access channel, including:

存储器;Memory;

处理器;processor;

其中,所述存储器存储计算机执行指令;Wherein, the memory stores computer-executable instructions;

所述处理器执行所述存储器存储的计算机执行指令,以实现如上述第一方面及第一方面各种可能的实现方式所述的网络访问通道的建立方法。The processor executes the computer-executable instructions stored in the memory to implement the method for establishing a network access channel as described in the first aspect and various possible implementations of the first aspect.

第八方面,本申请提供一种计算机存储介质,其上存储有计算机执行指令,所述计算机执行指令被处理器执行以实现如上述第一方面及第一方面各种可能的实现方式所述的网络访问通道的建立方法。In an eighth aspect, the present application provides a computer storage medium having computer execution instructions stored thereon, wherein the computer execution instructions are executed by a processor to implement the method for establishing a network access channel as described in the first aspect and various possible implementations of the first aspect.

本申请提供的网络访问通道的建立方法,在检测到终端设备IP地址变更时,终端设备首先会生成新的地址指令并通过信令服务器发送给代理服务器,以便代理服务器及时更新其存储的IP地址,然后在确定了客户端处于启动状态时,通过代理服务器对客户端的第二地址存储器进行更新处理,最后在确定了客户端的当前网络环境为移动网络环境时,代理服务器和信令服务器将协同构建网络访问通道。该方法解决了现有技术中MQTT协议依赖代理服务器传输数据、违反本地存储原则、增加信息泄露风险,以及在网络环境切换时缺乏灵活适配机制的问题,进而提高了网络通信的效率和稳定性,从而为用户提供了更加流畅的网络体验。The method for establishing a network access channel provided by the present application is that when a change in the IP address of a terminal device is detected, the terminal device will first generate a new address instruction and send it to the proxy server through the signaling server so that the proxy server can update its stored IP address in time, and then when it is determined that the client is in the startup state, the second address storage of the client is updated through the proxy server, and finally when it is determined that the current network environment of the client is a mobile network environment, the proxy server and the signaling server will jointly build a network access channel. This method solves the problems in the prior art that the MQTT protocol relies on the proxy server to transmit data, violates the local storage principle, increases the risk of information leakage, and lacks a flexible adaptation mechanism when switching the network environment, thereby improving the efficiency and stability of network communication, thereby providing users with a smoother network experience.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

图1是本申请提供的网络访问通道的建立方法的流程图一;FIG1 is a flowchart of a method for establishing a network access channel provided by the present application;

图2是本申请提供的网络访问通道的建立方法的流程图二;FIG2 is a second flowchart of the method for establishing a network access channel provided by the present application;

图3是本申请提供的网络访问通道的建立方法的流程图三;FIG3 is a flowchart of a method for establishing a network access channel provided by the present application;

图4是本申请提供的网络访问通道的建立装置的结构示意图一;FIG4 is a first structural diagram of a device for establishing a network access channel provided by the present application;

图5是本申请提供的网络访问通道的建立装置的结构示意图二;FIG5 is a second structural diagram of the device for establishing a network access channel provided by the present application;

图6是本申请提供的网络访问通道的建立装置的结构示意图三;FIG6 is a third structural diagram of the device for establishing a network access channel provided by the present application;

图7是本申请提供的网络访问通道的建立设备的结构示意图。FIG. 7 is a schematic diagram of the structure of a device for establishing a network access channel provided in the present application.

通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments.

具体实施方式Detailed ways

为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例例如能够以除了在这里图示或描述的那些以外的顺序实施。The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein, for example.

本申请实施例中,“示例性的”或者“例如”等词用于表示例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

首先,对本申请涉及的名词进行解释说明。First, the terms involved in this application are explained.

IP地址(Internet Protocol Address):IP地址是指互联网协议地址,又译为网际协议地址。它是IP协议提供的一种统一的地址格式,用于为互联网上的每一个网络和每一台主机分配一个逻辑地址,以此来屏蔽物理地址的差异。简单来说,IP地址就像是网络世界中的“门牌号”,它让计算机能够互相识别和通信。IP address (Internet Protocol Address): IP address refers to the Internet Protocol address, which is also translated as Internet Protocol address. It is a unified address format provided by the IP protocol, which is used to assign a logical address to each network and each host on the Internet to shield the difference in physical addresses. In simple terms, the IP address is like a "house number" in the network world, which allows computers to recognize and communicate with each other.

对于终端设备(如智能手机、智能电视、智能音箱、智能打印机等)来说,其IP地址是指该设备在网络中的唯一标识符。当设备连接到互联网时,它会被分配一个IP地址,这个地址通常由四组数字组成,每组数字之间用点(.)分隔。例如,一个典型的IPv4地址可能看起来像这样:192.168.1.1。这个地址用于标识设备在网络中的位置,并允许其他设备与之进行通信。For terminal devices (such as smartphones, smart TVs, smart speakers, smart printers, etc.), their IP address refers to the unique identifier of the device in the network. When a device is connected to the Internet, it is assigned an IP address, which usually consists of four groups of numbers, each separated by a dot (.). For example, a typical IPv4 address may look like this: 192.168.1.1. This address is used to identify the location of the device in the network and allow other devices to communicate with it.

随着物联网(IoT)技术的快速发展,终端设备的智能化水平得到了显著提升,使得家庭和办公场所对于具备智能化操作系统的终端设备(如智能电视、智能音箱、智能打印机等)的需求日益增强。为了满足这些需求以及复杂的业务场景,如文件传输和视频资源本地播放,MQTT协议被广泛采用。该协议能够实现终端设备与客户端之间的互联互通,促进数据共享和协同工作,从而为用户带来更加智能化和便捷的生活和工作方式。With the rapid development of Internet of Things (IoT) technology, the intelligence level of terminal devices has been significantly improved, which has led to an increasing demand for terminal devices with intelligent operating systems (such as smart TVs, smart speakers, smart printers, etc.) in homes and offices. In order to meet these needs and complex business scenarios, such as file transfer and local playback of video resources, the MQTT protocol has been widely adopted. This protocol can achieve interconnection between terminal devices and clients, promote data sharing and collaborative work, and thus bring users a more intelligent and convenient way of life and work.

然而,现有的MQTT协议在进行数据传输时通常存在如下缺点:However, the existing MQTT protocol usually has the following disadvantages when transmitting data:

1、无法本地化处理数据:在处理复杂的业务场景时,通常需要将文件上传到代理服务器进行中转。这种方式违背了用户信息本地存放的原则,可能导致用户信息泄露。1. Inability to process data locally: When dealing with complex business scenarios, files usually need to be uploaded to a proxy server for transfer. This method violates the principle of local storage of user information and may lead to leakage of user information.

2、服务器资源占用:由于文件数据需要通过服务器中转,这无疑增加了服务器的带宽和存储负担,增加了运营成本。2. Server resource occupation: Since file data needs to be transferred through the server, this undoubtedly increases the server's bandwidth and storage burden, and increases operating costs.

3、操作交互体验差:当用户需要即时响应的业务操作时,由于信令的延迟,他们可能无法快速获得结果,这影响了用户体验。3. Poor operational interaction experience: When users require business operations with immediate responses, they may not be able to obtain results quickly due to signaling delays, which affects the user experience.

4、无法灵活网络切换:在局域网和其他网络环境下,客户端与终端设备的访问方式无法灵活切换,这使得我们无法充分利用局域网的高速访问优势。4. Inability to flexibly switch networks: In LAN and other network environments, the access methods of clients and terminal devices cannot be flexibly switched, which makes it impossible for us to fully utilize the high-speed access advantages of the LAN.

因此,针对现有技术中MQTT协议依赖代理服务器传输数据、违反本地存储原则、增加信息泄露风险,以及在网络环境切换时缺乏灵活适配机制的问题,亟需提出有效的解决方案。Therefore, it is urgent to propose an effective solution to the problems in the existing technology that the MQTT protocol relies on proxy servers to transmit data, violates the local storage principle, increases the risk of information leakage, and lacks a flexible adaptation mechanism when switching network environments.

针对上述问题,本申请提供一种网络访问通道的建立方法,在检测到终端设备IP地址变更时,终端设备首先会生成新的地址指令并通过信令服务器发送给代理服务器,以便代理服务器及时更新其存储的IP地址,然后在确定了客户端处于启动状态时,通过代理服务器对客户端的第二地址存储器进行更新处理,最后在确定了客户端的当前网络环境为移动网络环境时,代理服务器和信令服务器将协同构建网络访问通道。该方法解决了现有技术中MQTT协议依赖代理服务器传输数据、违反本地存储原则、增加信息泄露风险,以及在网络环境切换时缺乏灵活适配机制的问题,进而提高了网络通信的效率和稳定性,从而为用户提供了更加流畅的网络体验。In response to the above problems, the present application provides a method for establishing a network access channel. When a change in the IP address of a terminal device is detected, the terminal device will first generate a new address instruction and send it to the proxy server through a signaling server so that the proxy server can update its stored IP address in a timely manner. Then, when it is determined that the client is in the startup state, the second address memory of the client is updated through the proxy server. Finally, when it is determined that the current network environment of the client is a mobile network environment, the proxy server and the signaling server will jointly build a network access channel. This method solves the problems in the prior art that the MQTT protocol relies on a proxy server to transmit data, violates the local storage principle, increases the risk of information leakage, and lacks a flexible adaptation mechanism when switching network environments, thereby improving the efficiency and stability of network communications, thereby providing users with a smoother network experience.

下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

图1是本申请提供的网络访问通道的建立方法的流程图一。如图1所示,本实施例示出的一种网络访问通道的建立方法,包括:FIG1 is a flowchart of a method for establishing a network access channel provided by the present application. As shown in FIG1 , a method for establishing a network access channel shown in this embodiment includes:

S101:所述终端设备获取终端设备的局域网络信息,所述局域网络信息包括:IP地址。S101: The terminal device obtains local area network information of the terminal device, and the local area network information includes: an IP address.

其中,通过获取终端设备的局域网络信息,就能够得到终端设备在局域网中的身份标识,也即IP地址,以便根据IP地址来实现终端设备和客户端之间的通信交互。Among them, by obtaining the local area network information of the terminal device, the identity of the terminal device in the local area network, that is, the IP address, can be obtained, so as to realize the communication interaction between the terminal device and the client according to the IP address.

可以理解的,IP地址是终端设备在网络中的唯一标识符,它允许其他设备在局域网内部准确地找到并与之通信。因此,通过获取终端设备的局域网络信息,终端设备能够构建出完整的网络通信环境,确保它能够与其他设备或客户端进行稳定、有效的通信交互。此外,客户端也需要了解终端设备的网络配置信息,以便正确地建立连接、发送请求并接收来自终端设备的响应。As you can understand, the IP address is the unique identifier of the terminal device in the network, which allows other devices to accurately find and communicate with it within the local area network. Therefore, by obtaining the local area network information of the terminal device, the terminal device can build a complete network communication environment to ensure that it can communicate and interact with other devices or clients stably and effectively. In addition, the client also needs to understand the network configuration information of the terminal device in order to correctly establish a connection, send requests and receive responses from the terminal device.

获取终端设备的局域网络信息的方式例如可以为通过调用编程接口获取到的,也可以是从DHCP服务器中获取到的,还可以是使用ARP(地址解析协议)来查询局域网中终端设备的IP地址,本申请对此不做限制。The method of obtaining the local area network information of the terminal device can be, for example, by calling a programming interface, or by obtaining it from a DHCP server, or by using ARP (Address Resolution Protocol) to query the IP address of the terminal device in the local area network. This application does not impose any restrictions on this.

可选的,在获取终端设备的局域网络信息之前,所述终端设备需要执行的步骤包括但不限于如下:获取终端设备的第一运行状态,并在所述目标运行状态为第一启动状态时,启动HTTP接口服务,以及向所述信令服务器发送第一连接请求,以使所述信令服务器根据所述第一连接请求,建立第一MQTT连接关系。Optionally, before obtaining the local area network information of the terminal device, the steps that the terminal device needs to perform include but are not limited to the following: obtaining the first operating state of the terminal device, and when the target operating state is the first startup state, starting the HTTP interface service, and sending a first connection request to the signaling server, so that the signaling server establishes a first MQTT connection relationship according to the first connection request.

其中,第一运行状态用于指示终端设备在当前时刻的运行状态,如关闭状态、启动状态。HTTP接口服务指的是基于HTTP协议的服务,允许终端设备通过HTTP请求和响应与客户端进行通信和数据交换。第一连接请求用于指示请求与信令服务器建立MQTT连接关系。The first operation state is used to indicate the operation state of the terminal device at the current moment, such as shutdown state and startup state. The HTTP interface service refers to a service based on the HTTP protocol, which allows the terminal device to communicate and exchange data with the client through HTTP requests and responses. The first connection request is used to indicate a request to establish an MQTT connection relationship with the signaling server.

由于运行状态是终端设备工作状态的直接反映,并且它包含了终端设备当前的工作状况、资源使用情况等关键信息,因此,通过实时获取第一运行状态,终端设备能够精准地掌握自己在当前时刻的工作状态,以便终端设备能够根据实际情况进行自我调节。Since the operating status is a direct reflection of the working status of the terminal device, and it contains key information such as the current working status and resource usage of the terminal device, by acquiring the first operating status in real time, the terminal device can accurately grasp its own working status at the current moment, so that the terminal device can self-adjust according to actual conditions.

获取终端设备的第一运行状态的方式例如可以是查询终端设备的应用程序日志得到的,也可以是通过硬件传感器得到的,还可以是通过使用第三方系统监控工具(如Zabbix、Nagios、Prometheus等)得到的。本申请对此不做特殊限制。The first operating state of the terminal device may be obtained by, for example, querying the application log of the terminal device, or by hardware sensors, or by using a third-party system monitoring tool (such as Zabbix, Nagios, Prometheus, etc.). This application does not impose any special restrictions on this.

在确认了终端设备的运行状态为启动状态后,为了确保终端设备能够与信令服务器实时交换消息和指令,终端设备会主动向信令服务器发送第一连接请求,以建立基于MQTT协议的通信连接。这样,终端设备和信令服务器就可以进行高效的实时通信。After confirming that the terminal device is in the startup state, in order to ensure that the terminal device can exchange messages and instructions with the signaling server in real time, the terminal device will actively send a first connection request to the signaling server to establish a communication connection based on the MQTT protocol. In this way, the terminal device and the signaling server can communicate efficiently in real time.

然而,为了让客户端(如用户的手机或电脑)能够方便地访问终端设备并与之交换数据,终端设备还需要提供HTTP接口服务。这意味着客户端可以通过发送HTTP请求来查询终端设备的状态、发送控制指令等。However, in order for the client (such as the user's mobile phone or computer) to easily access the terminal device and exchange data with it, the terminal device also needs to provide HTTP interface services. This means that the client can query the status of the terminal device, send control instructions, etc. by sending HTTP requests.

可以理解的,由于MQTT是一种轻量级的消息队列遥测传输协议,适用于物联网(IoT)场景中的设备间通信,因此,在终端设备与信令服务器建立了MQTT连接建立时,信令服务器就在终端设备与MQTT通信协议之间起到了桥接的作用,从而可以确保通信的顺畅性和实时性。It is understandable that since MQTT is a lightweight message queue telemetry transmission protocol suitable for device-to-device communication in the Internet of Things (IoT) scenario, when the terminal device establishes an MQTT connection with the signaling server, the signaling server acts as a bridge between the terminal device and the MQTT communication protocol, thereby ensuring smooth and real-time communication.

同时,由于HTTP接口服务是终端设备提供的一种功能,它使得终端设备能够通过HTTP协议与外部系统(如客户端)进行通信和数据交换。这种服务允许设备响应来自客户端的请求,并发送数据或执行操作。因此,为了让客户端能够通过HTTP协议与之通信和数据交换,需要启动HTTP接口服务。At the same time, since the HTTP interface service is a function provided by the terminal device, it enables the terminal device to communicate and exchange data with external systems (such as clients) through the HTTP protocol. This service allows the device to respond to requests from the client and send data or perform operations. Therefore, in order for the client to communicate and exchange data with it through the HTTP protocol, the HTTP interface service needs to be started.

例如,假设有一个智能家居系统,其中包含一个智能灯泡作为终端设备,以及一个用户的手机作为客户端。用户通过手机应用向智能灯泡发送指令,控制其开关状态。这个系统基于MQTT协议进行通信,手机应用通过HTTP接口与智能灯泡进行交互。For example, suppose there is a smart home system that includes a smart light bulb as a terminal device and a user's mobile phone as a client. The user sends instructions to the smart light bulb through the mobile app to control its on/off state. This system communicates based on the MQTT protocol, and the mobile app interacts with the smart light bulb through the HTTP interface.

智能灯泡首次连接到家庭Wi-Fi网络,并获得了IP地址192.168.1.100。手机应用与智能灯泡之间已经建立了MQTT连接,并且可以通过HTTP接口正常通信。The smart bulb is connected to the home Wi-Fi network for the first time and has obtained the IP address 192.168.1.100. An MQTT connection has been established between the mobile app and the smart bulb, and they can communicate normally through the HTTP interface.

S102:所述终端设备实时检测所述IP地址是否发生改变,并在所述IP地址发生改变时,确定所述终端设备的新的IP地址。S102: The terminal device detects in real time whether the IP address has changed, and determines a new IP address of the terminal device when the IP address has changed.

其中,检测终端设备的IP地址是否发生改变的目的是为了:确定终端设备和客户端之间的通信连接是否发生中断。The purpose of detecting whether the IP address of the terminal device has changed is to determine whether the communication connection between the terminal device and the client is interrupted.

可以理解的,由于IP地址是网络设备在网络中的唯一标识,并且通信连接是基于这些IP地址建立的。因此,需要实时检测终端设备的IP地址是否发生改变,以避免终端设备与客户端之间的通信出现失败现象。It is understandable that since the IP address is the unique identifier of the network device in the network, and the communication connection is established based on these IP addresses, it is necessary to detect in real time whether the IP address of the terminal device has changed to avoid communication failure between the terminal device and the client.

若检测到终端设备的IP地址发生改变,则表明终端设备和客户端之间的通信连接发生了中断,此时,可以确定终端设备的新的IP地址。If it is detected that the IP address of the terminal device has changed, it indicates that the communication connection between the terminal device and the client has been interrupted. At this time, the new IP address of the terminal device can be determined.

若检测到终端设备的IP地址未发生改变,则表明终端设备和客户端之间的通信连接没有发生中断,此时,可以基于IP地址,使得终端设备和客户端进行通信和数据交换。If it is detected that the IP address of the terminal device has not changed, it indicates that the communication connection between the terminal device and the client has not been interrupted. At this time, the terminal device and the client can communicate and exchange data based on the IP address.

例如,假设在智能家居系统中,家庭Wi-Fi网络重新进行了配置,此时智能灯泡的IP地址从192.168.1.100变为了192.168.1.105。此时,手机应用仍然尝试通过旧的IP地址192.168.1.100与智能灯泡进行通信,那么手机应用无法再通过旧的IP地址与智能灯泡建立通信连接。For example, suppose that in a smart home system, the home Wi-Fi network is reconfigured and the IP address of the smart light bulb is changed from 192.168.1.100 to 192.168.1.105. At this time, the mobile app still tries to communicate with the smart light bulb through the old IP address 192.168.1.100, so the mobile app can no longer establish a communication connection with the smart light bulb through the old IP address.

S103:所述终端设备根据所述新的IP地址,生成变更地址指令。S103: The terminal device generates an address change instruction according to the new IP address.

其中,变更地址指令用于指示对当前存储的IP地址进行更新处理。The address change instruction is used to instruct to update the currently stored IP address.

当终端设备的IP地址发生变化时,由于与其通信的组件(如信令服务器、客户端等)仍然保存着旧的IP地址信息,因此为了让这些组件能够继续与终端设备保持通信,需要生成变更地址指令,以便通知与终端设备相关的组件关于终端设备IP地址的变化。When the IP address of a terminal device changes, since the components that communicate with it (such as signaling servers, clients, etc.) still store the old IP address information, in order to enable these components to continue to communicate with the terminal device, it is necessary to generate an address change instruction to notify the components related to the terminal device about the change in the IP address of the terminal device.

可以理解的,IP地址的变更可能导致通信中断,因为旧的连接是基于旧的IP地址建立的。因此通过生成变更地址指令,终端设备可以主动通知其他组件更新连接,从而确保通信的连续性。It is understandable that a change in IP address may cause communication interruption because the old connection is established based on the old IP address. Therefore, by generating a change address instruction, the terminal device can actively notify other components to update the connection, thereby ensuring the continuity of communication.

同时,如果IP地址变更后没有通知其他组件,那么这些组件可能会尝试使用旧的IP地址与终端设备通信,导致通信失败。因此生成变更地址指令可以减少这种通信故障的可能性。At the same time, if other components are not notified after the IP address is changed, these components may try to communicate with the terminal device using the old IP address, resulting in communication failure. Therefore, generating a change address instruction can reduce the possibility of such communication failure.

S104:所述终端设备将所述变更地址指令发送至信令服务器。S104: The terminal device sends the address change instruction to the signaling server.

其中,信令服务器的作用包括:对外提供MQTT设备连接能力、负责接收和转发MQTT消息。Among them, the functions of the signaling server include: providing MQTT device connection capabilities to the outside world, and being responsible for receiving and forwarding MQTT messages.

终端设备在完成IP地址变更后,会主动将包含新IP地址信息的变更地址指令发送给信令服务器,以使信令服务器将来自终端设备的变更地址指令,转发给需要知道终端设备新IP地址的其他相关组件(如代理服务器)。After completing the IP address change, the terminal device will actively send an address change instruction containing the new IP address information to the signaling server, so that the signaling server will forward the address change instruction from the terminal device to other related components (such as the proxy server) that need to know the new IP address of the terminal device.

可以理解的,由于信令服务器被设计为负责接收和转发MQTT消息,并且为了性能考虑不涉及数据存储等操作,因此当终端设备发送变更地址指令时,信令服务器不会存储这些信息,而是会立即将其转发给所有需要更新IP地址信息的其他相关组件。It is understandable that since the signaling server is designed to be responsible for receiving and forwarding MQTT messages, and for performance reasons does not involve operations such as data storage, when the terminal device sends an address change instruction, the signaling server will not store this information, but will immediately forward it to all other related components that need to update the IP address information.

在这个过程中,信令服务器的作用类似于一个消息代理,它帮助终端设备和客户端之间传递变更地址指令,以确保通信的连续性和正确性。通过这种方式,系统能够在不涉及复杂存储操作的情况下,高效地处理IP地址变更的问题。In this process, the signaling server acts like a message agent, helping to transmit address change instructions between terminal devices and clients to ensure the continuity and correctness of communication. In this way, the system can efficiently handle IP address changes without involving complex storage operations.

S105:所述信令服务器将所述变更地址指令转发至代理服务器。S105: The signaling server forwards the address change instruction to the proxy server.

其中,代理服务器的作用包括:存储终端设备状态信息。The functions of the proxy server include: storing terminal device status information.

当信令服务器接收到来自终端设备的变更地址指令后,由于它不涉及数据存储操作,因此不会将指令信息存储在自己的服务器上。相反,信令服务器会将这个指令转发给代理服务器,以使代理服务器对变更后的IP地址进行存储。When the signaling server receives the address change instruction from the terminal device, it will not store the instruction information on its own server because it does not involve data storage operations. Instead, the signaling server will forward the instruction to the proxy server so that the proxy server can store the changed IP address.

可以理解的,通过信令服务器和代理服务器协同工作的方式,实现了终端设备IP地址变更后的通知和更新。终端设备的状态信息得以在代理服务器上得到及时更新,确保了通信的连续性和准确性。同时,由于信令服务器不涉及数据库存储操作,它能够专注于消息的快速转发,提高了整个系统的性能。It can be understood that the notification and update of the terminal device IP address change are realized through the collaborative work of the signaling server and the proxy server. The status information of the terminal device can be updated in time on the proxy server, ensuring the continuity and accuracy of communication. At the same time, since the signaling server does not involve database storage operations, it can focus on the rapid forwarding of messages, improving the performance of the entire system.

S106:所述代理服务器根据所述变更地址指令,对所述代理服务器的第一地址存储器进行更新处理。S106: The proxy server updates the first address memory of the proxy server according to the address change instruction.

其中,第一地址存储器用于对终端设备的IP地址进行记录。The first address memory is used to record the IP address of the terminal device.

当代理服务器接收到来自信令服务器的变更地址指令后,它会根据该指令中提供的新IP地址信息,对其内部的第一地址存储器进行相应的更新操作,以确保通信的顺畅性和实时性。When the proxy server receives the address change instruction from the signaling server, it will update its internal first address memory accordingly according to the new IP address information provided in the instruction to ensure smooth and real-time communication.

可以理解的,代理服务器并不是静态地存储终端设备的IP地址信息。当终端设备移动、重新连接网络或由于其他原因导致其IP地址发生变化时,代理服务器需要知道这些变化并相应地更新其内部存储的信息,以便为客户端提供准确和可靠的IP地址信息,从而确保通信的顺畅性和实时性。It is understandable that the proxy server does not statically store the IP address information of the terminal device. When the terminal device moves, reconnects to the network, or its IP address changes due to other reasons, the proxy server needs to know these changes and update its internally stored information accordingly to provide the client with accurate and reliable IP address information, thereby ensuring smooth and real-time communication.

S107:客户端获取客户端的第二运行状态。S107: The client obtains a second operating state of the client.

其中,第二运行状态用于指示客户端在当前时刻的运行状态,如关闭状态、启动状态。The second running state is used to indicate the running state of the client at the current moment, such as the closed state and the started state.

通过实时获取第二运行状态,客户端就能够掌握自己在当前时刻的运行状态的信息,以便客户端能够根据实际情况确定其是否存在通信需求。By acquiring the second operating status in real time, the client can grasp the information of its own operating status at the current moment, so that the client can determine whether it has a communication demand according to the actual situation.

可以理解的,客户端通过实时获取第二运行状态,就能够准确掌握自身在当前时刻的性能和资源利用情况,从而可以根据这些情况来判断是否需要进行通信。It is understandable that by acquiring the second operating status in real time, the client can accurately grasp its own performance and resource utilization at the current moment, and thus can determine whether communication is required based on these conditions.

获取客户端的第二运行状态的方式例如可以是通过调用应用程序接口得到的,也可以时通过查看日志文件后得到的。本申请对此不做特殊限制。The second operation status of the client can be obtained by, for example, calling an application program interface or by viewing a log file, and this application does not impose any special restrictions on this.

S108:所述客户端在所述第二运行状态为第二启动状态时,将目标查询信息发送至所述代理服务器。S108: When the second running state is a second starting state, the client sends the target query information to the proxy server.

其中,目标查询信息是指获取与客户端存在关联关系的终端设备的IP地址。The target query information refers to obtaining the IP address of the terminal device that is associated with the client.

为了确保客户端内部存储的终端设备IP地址是最新的,客户端在启动后需要主动向一个存储了终端设备IP地址的服务器发送目标查询信息,以确定客户端内部存储的终端设备IP地址是否需要更新。In order to ensure that the terminal device IP address stored in the client is the latest, the client needs to actively send a target query message to a server storing the terminal device IP address after startup to determine whether the terminal device IP address stored in the client needs to be updated.

可以理解的,在确认了客户端的运行状态为启动状态后,为了确保客户端与终端设备之间的通信能够顺畅进行,客户端需要主动发起一个目标查询请求,将这个请求发送到存储了终端设备IP地址的服务器上,以确保客户端当前存储的终端设备IP地址处于有效状态。It is understandable that after confirming that the client's running status is in the startup state, in order to ensure smooth communication between the client and the terminal device, the client needs to actively initiate a target query request and send this request to the server where the terminal device IP address is stored to ensure that the terminal device IP address currently stored by the client is in a valid state.

S109:所述客户端将第二连接请求发送至所述信令服务器。S109: The client sends a second connection request to the signaling server.

其中,第二连接请求用于指示请求与信令服务器建立MQTT连接关系。The second connection request is used to indicate a request to establish an MQTT connection relationship with the signaling server.

客户端向信令服务器发送第二连接请求的目的是:为了建立一个基于MQTT协议的通信连接。The purpose of the client sending the second connection request to the signaling server is to establish a communication connection based on the MQTT protocol.

可以理解的,一旦确认客户端已经启动,为了确保与代理服务器之间能够实现实时的消息和指令交换,客户端会积极地向信令服务器发送第二连接请求,以确保客户端可以在信令服务器的支持下,与代理服务器进行高效且实时的通信。It is understandable that once it is confirmed that the client has been started, in order to ensure real-time message and instruction exchange with the proxy server, the client will actively send a second connection request to the signaling server to ensure that the client can communicate with the proxy server efficiently and in real time with the support of the signaling server.

S110:所述信令服务器根据所述第二连接请求,建立第二MQTT连接关系。S110: The signaling server establishes a second MQTT connection relationship according to the second connection request.

其中,通过建立第二MQTT连接,就意味着终端设备可以在信令服务器的支持下,与代理服务器进行高效且实时的通信,从而实现快速的数据传输和指令执行。Among them, by establishing the second MQTT connection, it means that the terminal device can communicate with the proxy server efficiently and in real time with the support of the signaling server, thereby achieving fast data transmission and instruction execution.

可以理解的,通过成功建立这个连接,不仅可以确保通信的实时性和数据的快速传输,还可以确保客户端和信令服务器之间就可以保持持续、稳定的通信连接,从而使得通信变得更加高效和可靠。It can be understood that by successfully establishing this connection, not only the real-time communication and the rapid transmission of data can be ensured, but also a continuous and stable communication connection can be maintained between the client and the signaling server, making the communication more efficient and reliable.

S111:所述代理服务器根据所述目标查询信息和所述第一地址存储器,确定目标查询结果。S111: The proxy server determines a target query result according to the target query information and the first address storage.

其中,当代理服务器接收到目标查询信息时,它会将查询信息作为查询标准,在第一地址存储器中进行匹配查找,从而确定出与客户端存在关联关系的终端设备的最新IP地址。When the proxy server receives the target query information, it uses the query information as a query standard and performs a matching search in the first address memory, thereby determining the latest IP address of the terminal device associated with the client.

可以理解的,代理服务器根据目标查询信息和第一地址存储器来确定目标查询结果是为了确保客户端能够获取到与它有直接通信需求或业务关联的终端设备的最新IP地址信息,从而实现与这些终端设备的实时、准确通信。It is understandable that the proxy server determines the target query result based on the target query information and the first address storage to ensure that the client can obtain the latest IP address information of the terminal devices with which it has direct communication needs or business associations, thereby achieving real-time and accurate communication with these terminal devices.

S112:所述代理服务器将所述目标查询结果发送至所述信令服务器。S112: The proxy server sends the target query result to the signaling server.

其中,由于代理服务器没有管理设备连接和下发MQTT消息的功能,而信令服务器具有接收和转发来自不同组件(如客户端和代理服务器)的请求和消息的功能。因此通过使用信令服务器,代理服务器不仅可以确保目标查询结果以一种可靠和有效的方式传递给客户端,还可以确保数据传输的安全性和可靠性。Among them, since the proxy server does not have the function of managing device connections and sending MQTT messages, the signaling server has the function of receiving and forwarding requests and messages from different components (such as clients and proxy servers). Therefore, by using the signaling server, the proxy server can not only ensure that the target query results are delivered to the client in a reliable and effective manner, but also ensure the security and reliability of data transmission.

S113:所述信令服务器将所述目标查询结果转发至所述客户端。S113: The signaling server forwards the target query result to the client.

其中,为了确保客户端能够正确地获取到与其关联的终端设备的IP地址信息,信令服务器会接收代理服务器发送的目标查询结果,并将其转发给客户端。In order to ensure that the client can correctly obtain the IP address information of the terminal device associated with it, the signaling server will receive the target query result sent by the proxy server and forward it to the client.

可以理解的,信令服务器作为通信的中间环节,负责将代理服务器获取的目标查询结果(即与客户端关联的终端设备的IP地址信息)传递给客户端,不仅可以确保客户端能够获取到它所需要的数据,还能够确保数据的安全性和通信的可靠性。It can be understood that the signaling server, as an intermediate link in communication, is responsible for transmitting the target query results obtained by the proxy server (i.e., the IP address information of the terminal device associated with the client) to the client, which not only ensures that the client can obtain the data it needs, but also ensures the security of the data and the reliability of communication.

S114:所述客户端根据所述目标查询结果,对所述客户端的第二地址存储器进行更新处理。S114: The client updates the second address storage of the client according to the target query result.

其中,第二地址存储器用于对终端设备的IP地址进行记录。The second address memory is used to record the IP address of the terminal device.

当客户端接收到来自信令服务器发送的目标查询结果后,它会根据该结果中提供的新IP地址信息,对其内部的第二地址存储器进行相应的更新操作,以确保通信的顺畅性和实时性。When the client receives the target query result sent from the signaling server, it will update its internal second address memory accordingly based on the new IP address information provided in the result to ensure smooth and real-time communication.

可以理解的,客户端并不是静态地存储终端设备的IP地址信息。当终端设备移动、重新连接网络或由于其他原因导致其IP地址发生变化时,客户但需要知道这些变化并相应地更新其内部存储的信息。It is understandable that the client does not statically store the IP address information of the terminal device. When the terminal device moves, reconnects to the network, or its IP address changes due to other reasons, the client needs to know these changes and update its internally stored information accordingly.

此外,更新第二地址存储器是为了确保当终端设备和客户端下一次需要与终端设备通信时,客户端使用的是最新的、正确的IP地址,从而避免因使用过时或错误的IP地址而导致的通信中断或延迟。In addition, the second address memory is updated to ensure that when the terminal device and the client need to communicate with the terminal device next time, the client uses the latest and correct IP address, thereby avoiding communication interruption or delay caused by using an outdated or wrong IP address.

S115:所述客户端获取所述客户端的当前网络环境,并在所述当前网络环境为移动网络环境时,根据所述移动网络环境,生成网络通道创建指令。S115: The client obtains a current network environment of the client, and when the current network environment is a mobile network environment, generates a network channel creation instruction according to the mobile network environment.

其中,当前网络环境用于指示客户端在当前时刻的网络连接方式,如Wi-Fi网络环境、移动网络环境。网络通道创建指令用于指示请求与终端设备创建远程访问连接。The current network environment is used to indicate the network connection mode of the client at the current moment, such as Wi-Fi network environment and mobile network environment. The network channel creation instruction is used to indicate a request to create a remote access connection with a terminal device.

通过获取客户端的当前网络环境,客户端就能够了解数据传输的条件和限制,从而可以在网络环境的基础之上,决定采用何种数据传输策略。如在Wi-Fi网络环境下,客户端可能会通过局域网的形式选择发送数据;而在4G网络环境下,客户端可能会采用远程连接的方式来实现数据的传输。By obtaining the client's current network environment, the client can understand the conditions and limitations of data transmission, and can decide which data transmission strategy to adopt based on the network environment. For example, in a Wi-Fi network environment, the client may choose to send data through a local area network; while in a 4G network environment, the client may use a remote connection to achieve data transmission.

获取客户端的当前网络环境的方式例如可以是通过调用网络相关的API接口得到,也可以是通过查看监听器后得到的。本申请对此不做特殊限制。The current network environment of the client can be obtained by, for example, calling a network-related API interface or by checking a listener, and this application does not impose any special restrictions on this.

在确定了客户端启动,且使用的网络环境为移动网络环境时,就意味着终端设备和客户端无法直接进行通信,此时为了避免出现通信中断的现象,需要根据移动网络环境,生成网络通道创建指令。When it is determined that the client is started and the network environment used is a mobile network environment, it means that the terminal device and the client cannot communicate directly. In order to avoid communication interruption, it is necessary to generate a network channel creation instruction based on the mobile network environment.

可以理解的,不同局域网内的通信方式则涉及到跨越多个物理网络范围的数据通信,因此当确定了终端设备和客户端位于不同的局域网内时,需要选择最适合当前网络状况的通信方式来进行连接和数据传输,进而确保终端设备和客户端之间的通信流畅性,从而确保数据传输的可靠性。It is understandable that the communication methods within different LANs involve data communications across multiple physical network ranges. Therefore, when it is determined that the terminal device and the client are located in different LANs, it is necessary to select the communication method that best suits the current network conditions for connection and data transmission, thereby ensuring smooth communication between the terminal device and the client, thereby ensuring the reliability of data transmission.

S116:所述客户端将所述网络通道创建指令发送至所述代理服务器。S116: The client sends the network channel creation instruction to the proxy server.

其中,由于代理服务器负责存储终端设备状态信息,因此通过将网络通道创建指令发送给代理服务器,客户端能够确保网络通道创建指令被正确地处理和执行,从而确保网络通信的顺畅和可靠。Among them, since the proxy server is responsible for storing the terminal device status information, by sending the network channel creation instruction to the proxy server, the client can ensure that the network channel creation instruction is correctly processed and executed, thereby ensuring smooth and reliable network communication.

可以理解的,通过将网络通道创建指令发送给代理服务器,不仅确保代理服务器能够正确处理和维护终端设备的状态信息,还有助于减少通信故障和延迟,从而提高网络通信的整体性能。It can be understood that by sending the network channel creation instruction to the proxy server, it not only ensures that the proxy server can correctly process and maintain the status information of the terminal device, but also helps to reduce communication failures and delays, thereby improving the overall performance of network communications.

S117:所述代理服务器根据所述网络通道创建指令,生成远程访问地址。S117: The proxy server generates a remote access address according to the network channel creation instruction.

其中,当代理服务器接收到客户端发送的网络通道创建指令时,它会对网络通道创建指令进行处理分析,得到具有身份标识的远程访问地址,从而实现终端设备和客户端之间的通信正确性和安全性。Among them, when the proxy server receives the network channel creation instruction sent by the client, it will process and analyze the network channel creation instruction to obtain a remote access address with an identity identifier, thereby achieving the correctness and security of communication between the terminal device and the client.

可以理解的,通过生成远程访问地址,代理服务器可以提供额外的安全层。例如,代理服务器可以生成一个临时的、加密的访问地址,只有拥有相应权限和凭证的客户端才能访问。这种机制可以防止未经授权的访问和恶意攻击。As you can understand, by generating remote access addresses, proxy servers can provide an additional layer of security. For example, a proxy server can generate a temporary, encrypted access address that can only be accessed by clients with the appropriate permissions and credentials. This mechanism can prevent unauthorized access and malicious attacks.

S118:所述代理服务器将所述远程访问地址发送至所述信令服务器。S118: The proxy server sends the remote access address to the signaling server.

其中,由于代理服务器没有管理设备连接和下发MQTT指令的功能,而信令服务器具有负责接收和转发MQTT消息的功能。因此通过将远程访问地址发送至信令服务器,代理服务器不仅能够利用信令服务器的中介功能和额外的安全/可靠性特性,还能够确保数据在不同组件之间的高效传输,从而确保通信的顺畅和安全性。Among them, since the proxy server does not have the function of managing device connections and issuing MQTT instructions, while the signaling server is responsible for receiving and forwarding MQTT messages, by sending the remote access address to the signaling server, the proxy server can not only utilize the intermediary function and additional security/reliability features of the signaling server, but also ensure the efficient transmission of data between different components, thereby ensuring smooth and secure communication.

S119:所述信令服务器将所述远程访问地址发送至所述客户端。S119: The signaling server sends the remote access address to the client.

其中,远程访问地址可以被视为一种访问凭证,它赋予访问者(即客户端)在访问特定终端设备时,携带有安全认证信息(如令牌或密钥),因此,通过将远程访问地址发送给客户端,不仅可以确保客户端可以和终端设备之间进行安全访问,还可以避免终端设备受到未经授权的设备访问,从而确保网络通信的高效和稳定。Among them, the remote access address can be regarded as an access credential, which enables the visitor (ie, the client) to carry security authentication information (such as a token or key) when accessing a specific terminal device. Therefore, by sending the remote access address to the client, it can not only ensure that the client can have secure access to the terminal device, but also prevent the terminal device from being accessed by unauthorized devices, thereby ensuring efficient and stable network communication.

可选的,在信令服务器将远程访问地址发送至客户端之后,客户端需要执行的步骤包括但不限于如下:获取所述信令服务器发送的远程访问地址,并对所述远程访问地址进行存储处理,以使所述客户端根据所述远程访问地址,对所述终端设备进行远程访问。Optionally, after the signaling server sends the remote access address to the client, the steps that the client needs to perform include but are not limited to the following: obtaining the remote access address sent by the signaling server, and storing and processing the remote access address so that the client can remotely access the terminal device according to the remote access address.

其中,客户端通过获取信令服务器发送的远程访问地址,并对其进行存储处理,就意味着得到了对终端设备的访问权限或凭证,进而确保了只有经过授权的设备才能访问终端设备,从而增强了网络通信的安全性和可靠性。Among them, the client obtains the remote access address sent by the signaling server and stores and processes it, which means that it obtains access rights or credentials to the terminal device, thereby ensuring that only authorized devices can access the terminal device, thereby enhancing the security and reliability of network communications.

可以理解的,在客户端与终端设备进行通信和交互的过程中,只有持有有效远程访问地址的设备才能够访问终端设备。这种机制不仅阻止了未经授权的设备的访问,而且显著增强了网络通信的安全性。It is understandable that during the communication and interaction between the client and the terminal device, only the device holding the valid remote access address can access the terminal device. This mechanism not only prevents unauthorized devices from accessing, but also significantly enhances the security of network communications.

S120:所述信令服务器将所述远程访问地址转发至所述终端设备。S120: The signaling server forwards the remote access address to the terminal device.

其中,由于生成的远程访问地址具有身份标识,因此在进行通信访问时,为了确保访问者(即客户端)访问和被访问者(即终端设备)之间的可靠通信,需要将远程访问地址发送给终端设备,以使终端设备只能被拥有相应权限和凭证的客户端访问。Among them, since the generated remote access address has an identity identifier, when performing communication access, in order to ensure reliable communication between the visitor (i.e., the client) and the visited (i.e., the terminal device), the remote access address needs to be sent to the terminal device so that the terminal device can only be accessed by the client with corresponding permissions and credentials.

可以理解的,在代理服务器生成远程访问地址后,首先将这个地址发送给信令服务器,然后信令服务器将接收到的远程访问地址转发给终端设备,不仅能够确保远程访问地址在系统中得到正确的处理和传递,还能够确保通信的顺畅和安全性。It can be understood that after the proxy server generates the remote access address, it first sends this address to the signaling server, and then the signaling server forwards the received remote access address to the terminal device, which not only ensures that the remote access address is correctly processed and transmitted in the system, but also ensures smooth and secure communication.

S121:所述终端设备根据所述远程访问地址,建立网络访问通道。S121: The terminal device establishes a network access channel according to the remote access address.

其中,为了确保终端设备和客户端之间的可靠通信,终端设备需要根据接收到的远程访问地址建立网络访问通道。这个通道是两者之间数据传输的桥梁,它不仅避免了网络通信出现中断现象,还确保了数据能够安全、准确地从终端设备传输到客户端,或从客户端传输到终端设备。In order to ensure reliable communication between the terminal device and the client, the terminal device needs to establish a network access channel based on the received remote access address. This channel is a bridge for data transmission between the two. It not only avoids interruptions in network communication, but also ensures that data can be safely and accurately transmitted from the terminal device to the client, or from the client to the terminal device.

可选的,在终端设备建立完成网络访问通道时,客户端需要确定网络访问通道的通道使用状态是否可用,以确保客户端和终端设备进行信息交换,因此,客户端需要执行的步骤包括但不限于如下:对所述网络访问通道的通道状态进行检测处理,得到通道使用状态,并在所述使用状态为所述可用状态时,获取用户发送的业务请求指令,并根据所述业务请求指令和所述远程访问地址,生成目标网络请求;根据所述目标网络请求,对所述终端设备进行远程访问。Optionally, when the terminal device completes establishing the network access channel, the client needs to determine whether the channel usage status of the network access channel is available to ensure that the client and the terminal device can exchange information. Therefore, the steps that the client needs to perform include but are not limited to the following: detecting and processing the channel status of the network access channel to obtain the channel usage status, and when the usage status is the available status, obtaining the service request instruction sent by the user, and generating a target network request based on the service request instruction and the remote access address; and remotely accessing the terminal device based on the target network request.

其中,通道使用状态包括:可用状态、不可用状态。可用状态是指网络访问通道已经建立并且正常运行,允许客户端和终端设备进行数据传输。不可用状态是指网络访问通道由于某种原因无法建立或已经中断,不允许客户端和终端设备进行数据传输。The channel usage status includes: available status and unavailable status. Available status means that the network access channel has been established and is running normally, allowing the client and terminal device to transmit data. Unavailable status means that the network access channel cannot be established or has been interrupted for some reason, and the client and terminal device are not allowed to transmit data.

可以理解的,当网络访问通道的通道状态为可用状态时,客户端可以通过该通道发送和接收数据,终端设备也能正常响应客户端的请求。反之,当网络访问通道的通道状态为不可用状态时,客户端可能无法连接到终端设备,或者即使连接成功也可能无法进行数据传输。It is understandable that when the channel status of the network access channel is available, the client can send and receive data through the channel, and the terminal device can respond to the client's request normally. Conversely, when the channel status of the network access channel is unavailable, the client may not be able to connect to the terminal device, or even if the connection is successful, data transmission may not be possible.

当代理服务器生成远程访问地址并通过信令服务器传递给终端设备时,终端设备会依据此地址与代理服务器协同工作以建立网络访问通道。然而,由于通道的创建和变得可用需要一定的时间,这意味着在这段时间内,客户端和终端设备之间的通信和交互是无法进行的。为了确保客户端和终端设备之间的通信可靠,必须对网络访问通道进行检测处理。When the proxy server generates a remote access address and passes it to the terminal device through the signaling server, the terminal device will work with the proxy server based on this address to establish a network access channel. However, since it takes a certain amount of time for the channel to be created and become available, this means that during this period of time, communication and interaction between the client and the terminal device cannot be carried out. In order to ensure reliable communication between the client and the terminal device, the network access channel must be detected and processed.

而在得到了网络访问通道的使用状态为可用状态时,就意味着终端设备和客户端之间可以进行网络通信,此时为了满足用户的特定需求或执行特定的操作,获取用户发送的业务请求指令,并综合考虑业务请求指令和远程访问地址,生成目标网络请求,以实现客户端对终端设备的远程访问。When the usage status of the network access channel is available, it means that network communication can be carried out between the terminal device and the client. At this time, in order to meet the user's specific needs or perform specific operations, the service request instructions sent by the user are obtained, and the service request instructions and the remote access address are comprehensively considered to generate a target network request to realize the client's remote access to the terminal device.

本实施例提供的网络访问通道的建立方法,在获取到终端设备的局域网络信息后,首先可以对局域网络信息中的IP地址进行实时检测,然后在确定了IP地址发生改变后,生成具有新的IP地址的变更地址指令,并通过信令服务器将变更地址指令发送给代理服务器,以使得代理服务器对其内部存储的IP地址进行更新处理,接着,在确定了客户端的运行状态为启动状态,且在客户端向代理服务器发送给目标查询信息后,代理服务器可以将目标查询信息对应的目标查询结果发送至信令服务器,以使得信令服务器将目标查询结果转发至客户端,然后,客户端对其内部存储的IP地址进行更新处理,并在确定了客户端的当前网络环境为移动网络环境时,将网络通道创建指令发送至代理服务器,接着,代理服务器生成了与网络通道创建指令对应的远程访问地址后,通过信令服务器将远程访问地址分别发送至客户端和终端设备,最后,客户端对远程访问地址进行存储,终端设备在代理服务器的作用下,建立网络访问通道。The method for establishing a network access channel provided in this embodiment, after obtaining the local area network information of the terminal device, can firstly perform real-time detection on the IP address in the local area network information, then after determining that the IP address has changed, generate an address change instruction with a new IP address, and send the address change instruction to the proxy server through the signaling server, so that the proxy server updates the IP address stored internally therein, then, after determining that the running state of the client is the startup state, and after the client sends the target query information to the proxy server, the proxy server can send the target query result corresponding to the target query information to the signaling server, so that the signaling server forwards the target query result to the client, then, the client updates the IP address stored internally therein, and when determining that the current network environment of the client is a mobile network environment, sends the network channel creation instruction to the proxy server, then, after the proxy server generates a remote access address corresponding to the network channel creation instruction, sends the remote access address to the client and the terminal device respectively through the signaling server, finally, the client stores the remote access address, and the terminal device establishes a network access channel under the action of the proxy server.

该方法解决了现有技术中MQTT协议依赖代理服务器传输数据、违反本地存储原则、增加信息泄露风险,以及在网络环境切换时缺乏灵活适配机制的问题,进而提高了网络通信的效率和稳定性,从而为用户提供了更加流畅的网络体验。This method solves the problems in the existing technology that the MQTT protocol relies on proxy servers to transmit data, violates the local storage principle, increases the risk of information leakage, and lacks a flexible adaptation mechanism when switching network environments, thereby improving the efficiency and stability of network communications, thereby providing users with a smoother network experience.

图2是本申请提供的网络访问通道的建立方法的流程图二。本实施例是在图1实施例的基础上,对终端设备在建立网络访问通道之后的具体实现过程进行详细说明。如图2所示,本实施例示出的网络访问通道的建立方法,包括:FIG2 is a flowchart of the method for establishing a network access channel provided by the present application. This embodiment is based on the embodiment of FIG1 and describes in detail the specific implementation process of the terminal device after establishing the network access channel. As shown in FIG2, the method for establishing a network access channel shown in this embodiment includes:

S201:所述终端设备开启网络访问通道以及访问计时器,并对终端设备的访问计时器的计时时长进行更新处理,所述访问计时器用于对网络访问通道的开启时长进行记录。S201: The terminal device opens a network access channel and an access timer, and updates the timing duration of the access timer of the terminal device. The access timer is used to record the opening duration of the network access channel.

其中,终端设备开启网络访问通道的目的是为了实现与客户端之间的通信和数据交换,而开启访问计时器的目的则是为了更好地管理和监控网络访问通道的开启时长,以确保网络通信的可靠性、效率和安全性。Among them, the purpose of the terminal device opening the network access channel is to realize communication and data exchange with the client, and the purpose of opening the access timer is to better manage and monitor the opening time of the network access channel to ensure the reliability, efficiency and security of network communication.

可以理解的,为了确保终端设备能够对外提供服务或接收来自客户端的请求,需要在网络访问通道建立后,将网络访问通道开启,从而实现数据的交互。It is understandable that in order to ensure that the terminal device can provide services externally or receive requests from the client, it is necessary to open the network access channel after the network access channel is established, so as to realize data interaction.

而通过记录通道的开启时长,终端设备可以更好地管理其网络资源。如果通道长时间未使用,终端设备可能会选择关闭它,以释放资源供其他任务使用。By recording the length of time a channel is open, the end device can better manage its network resources. If a channel is not used for a long time, the end device may choose to close it to free up resources for other tasks.

S202:判断所述访问计时器的当前计时时长是否为预设空闲超时时长;若是,则执行步骤S203;若否,则执行步骤S204。S202: Determine whether the current timing duration of the access timer is the preset idle timeout duration; if so, execute step S203; if not, execute step S204.

其中,预设空闲超时时长例如为5S。The preset idle timeout period is, for example, 5S.

判断访问计时器的当前计时时长是否为预设空闲超时时长的目的是:为了确定网络访问通道是否被客户端和终端设备使用。The purpose of judging whether the current timing duration of the access timer is the preset idle timeout duration is to determine whether the network access channel is used by the client and the terminal device.

若访问计时器的当前计时时长为预设空闲超时时长,则表明网络访问通道没有被客户端和终端设备使用,此时,可以关闭网络访问通道。If the current timing duration of the access timer is the preset idle timeout duration, it indicates that the network access channel is not used by the client and the terminal device. At this time, the network access channel can be closed.

若访问计时器的当前计时时长不为预设空闲超时时长,则表明网络访问通道被客户端和终端设备使用,此时,可以判断访问计时器的当前计时时长是否达到预设使用时长。If the current timing duration of the access timer is not the preset idle timeout duration, it indicates that the network access channel is used by the client and the terminal device. At this time, it can be determined whether the current timing duration of the access timer reaches the preset usage duration.

S203:关闭网络访问通道。S203: Close the network access channel.

其中,在访问计时器的当前计时时长达到预设空闲超时时长时,则表明网络访问通道没有被客户端和终端设备使用,此时为了提高资源利用率,并对网络资源及时回收,需要关闭网络访问通道。Among them, when the current timing duration of the access timer reaches the preset idle timeout duration, it indicates that the network access channel is not used by the client and terminal device. At this time, in order to improve resource utilization and recycle network resources in time, the network access channel needs to be closed.

S204:判断所述当前计时时长是否达到预设使用时长;若是,则执行步骤S203;若否,则执行步骤S204。S204: Determine whether the current timing duration reaches the preset usage duration; if so, execute step S203; if not, execute step S204.

其中,预设空闲超时时长小于预设使用时长。预设使用时长例如可以为10min。The preset idle timeout duration is less than the preset usage duration, which may be 10 minutes, for example.

判断访问计时器的当前计时时长是否达到预设使用时长的目的是为了:确定网络访问通道的开启时长是否达到了网络访问通道的关闭时长。The purpose of judging whether the current timing duration of the access timer reaches the preset usage duration is to determine whether the opening duration of the network access channel reaches the closing duration of the network access channel.

若访问计时器的当前计时时长达到预设使用时长,则表明网络访问通道的开启时长达到了网络访问通道的关闭时长,此时,可以关闭网络访问通道。If the current timing duration of the access timer reaches the preset usage duration, it indicates that the opening duration of the network access channel has reached the closing duration of the network access channel. At this time, the network access channel can be closed.

若访问计时器的当前计时时长未达到预设使用时长,则表明网络访问通道的开启时长没有达到网络访问通道的关闭时长,此时,可以继续判断访问计时器的当前计时时长是否达到预设使用时长。If the current timing duration of the access timer does not reach the preset usage duration, it indicates that the opening duration of the network access channel has not reached the closing duration of the network access channel. At this time, it can continue to determine whether the current timing duration of the access timer reaches the preset usage duration.

本申请实施例提供的网络访问通道的建立方法,在终端设备建立了网络访问通道后,首先,开启网络访问通道以及访问计时器,并对访问计时器的计时时长进行更新处理;其次,在访问计时器的当前计时时长为预设空闲超时时长时,关闭网络访问通道,或者在访问计时器的当前计时时长不为预设空闲超时时长,且在当前计时时长达到预设使用时长时,关闭网络访问通道。The method for establishing a network access channel provided in an embodiment of the present application, after the terminal device establishes the network access channel, first, starts the network access channel and the access timer, and updates the timing duration of the access timer; secondly, when the current timing duration of the access timer is a preset idle timeout duration, closes the network access channel, or when the current timing duration of the access timer is not the preset idle timeout duration and the current timing duration reaches the preset usage duration, closes the network access channel.

该方法通过使用访问计时器,终端设备能够更有效地管理其网络资源,以便在网络访问通道长时间未使用时,关闭通道可以释放占用的资源,从而提高网络访问通道的使用效率。此外,通过设定预设空闲超时时长和预设使用时长,限制了网络访问通道的开启时间,从而降低了遭受网络攻击或数据泄露的风险。By using the access timer, the terminal device can more effectively manage its network resources, so that when the network access channel is not used for a long time, closing the channel can release the occupied resources, thereby improving the utilization efficiency of the network access channel. In addition, by setting a preset idle timeout duration and a preset usage duration, the opening time of the network access channel is limited, thereby reducing the risk of network attacks or data leaks.

图3为本申请提供的网络访问通道的建立方法的流程图三。如图3所示,本实施例是在图2实施例的基础上,对客户端当前的网络环境为Wi-Fi网络环境时,终端设备与客户端的通信的具体实现过程进行详细说明,本实施例提供的网络访问通道的建立方法,包括:FIG3 is a flowchart of the third method for establishing a network access channel provided by the present application. As shown in FIG3, this embodiment is based on the embodiment of FIG2, and describes in detail the specific implementation process of the communication between the terminal device and the client when the current network environment of the client is a Wi-Fi network environment. The method for establishing a network access channel provided by this embodiment includes:

S301:采用目标检测方式对客户端的第二地址存储器进行检测处理,得到目标检测结果,所述目标检测结果用于指示所述客户端和终端设备是否处于同一局域网络内;若是,则执行步骤S303;若否,则执行步骤S302。S301: Detect and process the second address memory of the client using a target detection method to obtain a target detection result, wherein the target detection result is used to indicate whether the client and the terminal device are in the same local area network; if so, execute step S303; if not, execute step S302.

其中,在确定了客户端的网络环境为网络环境后,为了确定客户端和终端设备是否处于同一局域网络,需要采用目标检测方式对所述第二地址存储器进行检测处理。After determining that the network environment of the client is a network environment, in order to determine whether the client and the terminal device are in the same local area network, it is necessary to use a target detection method to perform detection processing on the second address memory.

可以理解的,同一局域网络指的是终端设备与客户端都连接在同一个网络交换机或路由器上,共享相同的网络地址空间,因此在这种网络环境下,终端设备和客户端可以通过直接发送和接收数据包来进行通信。It can be understood that the same local area network means that the terminal device and the client are connected to the same network switch or router and share the same network address space. Therefore, in this network environment, the terminal device and the client can communicate by directly sending and receiving data packets.

相反的,不同局域网络指的是终端设备使用的一个Wi-Fi网络,客户端使用的是另一个Wi-Fi网络,因此,在这种网络环境下,终端设备和客户端无法直接进行通信,需要选择最适合当前网络状况的通信方式来进行连接和数据传输。On the contrary, different local area networks refer to a Wi-Fi network used by the terminal device and another Wi-Fi network used by the client. Therefore, in this network environment, the terminal device and the client cannot communicate directly and need to choose the communication method that best suits the current network conditions to connect and transmit data.

若目标检测结果指示客户端和终端设备处于同一局域网络内,则表明客户端和终端设备处于同一局域网络,此时,可以获取用户发送的业务请求指令。If the target detection result indicates that the client and the terminal device are in the same local area network, it means that the client and the terminal device are in the same local area network. At this time, the service request instruction sent by the user can be obtained.

若目标检测结果指示客户端和终端设备不处于同一局域网络内,则表明客户端和终端设备不处于同一局域网络,此时,可以根据客户端的Wi-Fi网络环境,生成网络通道创建指令。If the target detection result indicates that the client and the terminal device are not in the same local area network, it means that the client and the terminal device are not in the same local area network. At this time, a network channel creation instruction can be generated according to the client's Wi-Fi network environment.

S302:根据所述Wi-Fi网络环境,生成网络通道创建指令。S302: Generate a network channel creation instruction according to the Wi-Fi network environment.

其中,为了确保终端设备和客户端之间具有一个稳定的通信路径,需要根据客户端的Wi-Fi网络环境,生成网络通道创建指令。In order to ensure a stable communication path between the terminal device and the client, it is necessary to generate a network channel creation instruction based on the client's Wi-Fi network environment.

可以理解的,当确定了客户端和终端设备不处于同一局域网络时,就意味着它们连接到了不同的Wi-Fi网络,所以终端设备和客户端无法直接进行通信,因此,为了确保它们之间能够建立一个可靠的网络通信通道,需要生成网络通道创建指令,以使终端设备根据网络通道创建指令建立网络访问通道。It can be understood that when it is determined that the client and the terminal device are not in the same local area network, it means that they are connected to different Wi-Fi networks, so the terminal device and the client cannot communicate directly. Therefore, in order to ensure that a reliable network communication channel can be established between them, it is necessary to generate a network channel creation instruction so that the terminal device can establish a network access channel according to the network channel creation instruction.

S303:获取用户发送的业务请求指令。S303: Obtain the service request instruction sent by the user.

其中,获取用户发送的业务请求指令的目的是为了响应并处理这些请求,以满足用户的特定需求或执行特定的操作。The purpose of obtaining the service request instructions sent by the user is to respond to and process these requests to meet the user's specific needs or perform specific operations.

可以理解的,在确定了客户端和终端设备处于同一局域网络时,就意味着终端设备和客户端可以直接进行通信,而不需要额外的操作进行终端,此时,为了满足用户的特定需求或执行特定的操作,就需要获取用户发送的业务请求指令。It can be understood that when it is determined that the client and the terminal device are in the same local area network, it means that the terminal device and the client can communicate directly without the need for additional terminal operations. At this time, in order to meet the user's specific needs or perform specific operations, it is necessary to obtain the service request instructions sent by the user.

本申请实施例提供的网络访问通道的建立方法,在确定了客户端当前的网络环境为Wi-Fi网络环境后,采用目标检测方式对第二地址存储器进行检测处理,以确定客户端和终端设备是否处于同一局域网络内,而在确定了客户端和终端设备不处于同一局域网络内时,根据客户端当前的Wi-Fi网络环境,生成网络通道创建指令。The method for establishing a network access channel provided in an embodiment of the present application, after determining that the current network environment of the client is a Wi-Fi network environment, uses a target detection method to detect and process the second address memory to determine whether the client and the terminal device are in the same local area network. When it is determined that the client and the terminal device are not in the same local area network, a network channel creation instruction is generated according to the current Wi-Fi network environment of the client.

该方法通过综合考虑客户端的网络环境,确保了终端设备和客户端能够在复杂的网络环境中进行可靠的通信,进而增强了通信的灵活性和效率,从而使得整个通信过程更加清晰、高效和顺畅。This method ensures that the terminal device and the client can communicate reliably in a complex network environment by comprehensively considering the client's network environment, thereby enhancing the flexibility and efficiency of communication, making the entire communication process clearer, more efficient and smoother.

图4为本申请提供的网络访问通道的建立装置的结构示意图一。应用于终端设备。如图4所示,本申请提供一种网络访问通道的建立装置,该网络访问通道的建立装置400包括:FIG4 is a schematic diagram of the structure of the device for establishing a network access channel provided by the present application. Applicable to a terminal device. As shown in FIG4, the present application provides a device for establishing a network access channel, and the device for establishing a network access channel 400 includes:

获取模块401,用于获取终端设备的局域网络信息,所述局域网络信息包括:IP地址;The acquisition module 401 is used to acquire the local area network information of the terminal device, and the local area network information includes: an IP address;

检测模块402,用于实时检测所述IP地址是否发生改变;A detection module 402 is used to detect in real time whether the IP address has changed;

确定模块403,用于在所述IP地址发生改变时,确定所述终端设备的新的IP地址;A determination module 403, configured to determine a new IP address of the terminal device when the IP address changes;

生成模块404,用于根据所述新的IP地址,生成变更地址指令;A generating module 404, configured to generate an address change instruction according to the new IP address;

发送模块405,用于将所述变更地址指令发送至信令服务器,以使所述信令服务器将所述变更地址指令转发至代理服务器;A sending module 405, configured to send the change address instruction to a signaling server, so that the signaling server forwards the change address instruction to a proxy server;

所述获取模块401,还用于获取所述信令服务器发送的远程访问地址;The acquisition module 401 is further used to acquire the remote access address sent by the signaling server;

所述建立模块406,用于根据所述远程访问地址,建立网络访问通道。The establishing module 406 is used to establish a network access channel according to the remote access address.

可选的,所述获取模块401,还用于获取终端设备的第一运行状态;Optionally, the acquisition module 401 is further used to acquire a first operating state of the terminal device;

所述装置还包括:启动模块407;The device further comprises: a starting module 407;

所述启动模块407,用于并在所述目标运行状态为第一启动状态时,启动HTTP接口服务;The startup module 407 is used to start the HTTP interface service when the target running state is the first startup state;

所述发送模块405,还用于在所述目标运行状态为所述第一启动状态时,向所述信令服务器发送第一连接请求,以使所述信令服务器根据所述第一连接请求,建立第一MQTT连接关系。The sending module 405 is further configured to send a first connection request to the signaling server when the target running state is the first startup state, so that the signaling server establishes a first MQTT connection relationship according to the first connection request.

可选的,所述装置还包括:开启模块408;Optionally, the device further includes: an opening module 408;

所述开启模块408,用于开启网络访问通道以及访问计时器;The opening module 408 is used to open the network access channel and the access timer;

所述装置还包括:处理模块409;The device further includes: a processing module 409;

所述处理模块409,用于对所述访问计时器的计时时长进行更新处理,所述访问计时器用于对网络访问通道的开启时长进行记录;The processing module 409 is used to update the timing duration of the access timer, and the access timer is used to record the opening duration of the network access channel;

所述装置还包括:判断模块410;The device further includes: a determination module 410;

所述判断模块410,用于判断所述访问计时器的当前计时时长是否为预设空闲超时时长;The judging module 410 is used to judge whether the current timing duration of the access timer is a preset idle timeout duration;

所述装置还包括:关闭模块411;The device further comprises: a closing module 411;

所述关闭模块411,用于在所述访问计时器的当前计时时长为预设空闲超时时长时,关闭所述网络访问通道;The closing module 411 is used to close the network access channel when the current timing duration of the access timer is a preset idle timeout duration;

所述判断模块410,还用于在所述访问计时器的当前计时时长不为预设空闲超时时长时,判断所述当前计时时长是否达到预设使用时长,所述预设空闲超时时长小于所述预设使用时长;The judging module 410 is further configured to judge whether the current timing duration of the access timer reaches a preset usage duration when the current timing duration of the access timer is not a preset idle timeout duration, and the preset idle timeout duration is less than the preset usage duration;

所述关闭模块411,还用于在所述当前计时时长达到预设使用时长时,关闭所述网络访问通道。The closing module 411 is further configured to close the network access channel when the current timing duration reaches a preset usage duration.

图5为本申请提供的网络访问通道的建立装置的结构示意图二。应用于代理服务器。如图5所示,本申请提供一种网络访问通道的建立装置,该网络访问通道的建立装置500包括:FIG5 is a second structural diagram of a device for establishing a network access channel provided by the present application. Applicable to a proxy server. As shown in FIG5 , the present application provides a device for establishing a network access channel, and the device for establishing a network access channel 500 includes:

获取模块501,用于获取信令服务器发送的变更地址指令;The acquisition module 501 is used to acquire the address change instruction sent by the signaling server;

处理模块502,用于根据所述变更地址指令,对所述代理服务器的第一地址存储器进行更新处理;A processing module 502, configured to update the first address storage of the proxy server according to the address change instruction;

所述获取模块501,还用于获取客户端发送的目标查询信息;The acquisition module 501 is also used to acquire target query information sent by the client;

确定模块503,用于根据所述目标查询信息和所述第一地址存储器,确定目标查询结果;A determination module 503, configured to determine a target query result according to the target query information and the first address memory;

发送模块504,用于将所述目标查询结果发送至所述信令服务器,以使所述信令服务器将所述目标查询结果转发至所述客户端;A sending module 504 is used to send the target query result to the signaling server, so that the signaling server forwards the target query result to the client;

所述获取模块501,还用于获取所述客户端发送的网络通道创建指令;The acquisition module 501 is further used to acquire the network channel creation instruction sent by the client;

生成模块505,用于根据所述网络通道创建指令,生成远程访问地址;A generating module 505, configured to generate a remote access address according to the network channel creation instruction;

所述发送模块504,还用于将所述远程访问地址发送至所述信令服务器,以使所述信令服务器将所述远程访问地址分别转发至所述终端设备和所述客户端。The sending module 504 is further configured to send the remote access address to the signaling server, so that the signaling server forwards the remote access address to the terminal device and the client respectively.

图6为本申请提供的网络访问通道的建立装置的结构示意图三。应用于客户端。如图6所示,本申请提供一种网络访问通道的建立装置,该网络访问通道的建立装置600包括:FIG6 is a third structural diagram of a device for establishing a network access channel provided by the present application. Applied to a client. As shown in FIG6 , the present application provides a device for establishing a network access channel, and the device for establishing a network access channel 600 includes:

获取模块601,用于获取客户端的第二运行状态;An acquisition module 601 is used to acquire a second operation state of the client;

发送模块602,用于在所述第二运行状态为第二启动状态时,向所述代理服务器发送目标查询信息,以及向信令服务器发送第二连接请求,以使所述信令服务器根据所述第二连接请求,建立第二MQTT连接关系;A sending module 602 is used to send target query information to the proxy server and send a second connection request to the signaling server when the second operating state is the second startup state, so that the signaling server establishes a second MQTT connection relationship according to the second connection request;

所述获取模块602,还用于获取所述信令服务器发送的目标查询结果;The acquisition module 602 is further used to acquire the target query result sent by the signaling server;

处理模块603,用于根据所述目标查询结果,对所述客户端的第二地址存储器进行更新处理;The processing module 603 is used to update the second address storage of the client according to the target query result;

所述获取模块601,还用于获取所述客户端的当前网络环境;The acquisition module 601 is further used to acquire the current network environment of the client;

生成模块,用于在所述当前网络环境为移动网络环境时,根据所述移动网络环境,生成网络通道创建指令;A generating module, configured to generate a network channel creation instruction according to the mobile network environment when the current network environment is a mobile network environment;

发送模块602,还用于将所述网络通道创建指令发送至所述代理服务器,以使代理服务器根据所述网络通道创建指令,建立网络访问通道。The sending module 602 is further configured to send the network channel creation instruction to the proxy server, so that the proxy server establishes a network access channel according to the network channel creation instruction.

可选的,所述处理模块603,还用于在所述当前网络环境为Wi-Fi网络环境时,采用目标检测方式对所述第二地址存储器进行检测处理,得到目标检测结果,所述目标检测结果用于指示所述客户端和所述终端设备是否处于同一局域网络内;Optionally, the processing module 603 is further configured to, when the current network environment is a Wi-Fi network environment, use a target detection method to perform detection processing on the second address memory to obtain a target detection result, wherein the target detection result is used to indicate whether the client and the terminal device are in the same local area network;

所述生成模块604,还用于在所述地址检测结果指示所述客户端和所述终端设备不处于同一局域网络内时,根据所述Wi-Fi网络环境,生成所述网络通道创建指令。The generating module 604 is further configured to generate the network channel creation instruction according to the Wi-Fi network environment when the address detection result indicates that the client and the terminal device are not in the same local area network.

可选的,所述获取模块601,还用于获取所述信令服务器发送的远程访问地址;Optionally, the acquisition module 601 is further used to acquire a remote access address sent by the signaling server;

所述处理模块603,还用于对所述远程访问地址进行存储处理,以使所述客户端根据所述远程访问地址,对所述终端设备进行远程访问。The processing module 603 is further configured to store and process the remote access address, so that the client can remotely access the terminal device according to the remote access address.

图7为本申请提供的网络访问通道的建立设备的结构示意图。如图7所示,本申请提供一种网络访问通道的建立设备,该网络访问通道的建立设备700包括:接收器701、发送器702、处理器703以及存储器704。FIG7 is a schematic diagram of the structure of a device for establishing a network access channel provided by the present application. As shown in FIG7 , the present application provides a device for establishing a network access channel, and the device 700 for establishing a network access channel includes: a receiver 701 , a transmitter 702 , a processor 703 , and a memory 704 .

接收器701,用于接收指令和数据;Receiver 701, for receiving instructions and data;

发送器702,用于发送指令和数据;A transmitter 702, used for sending instructions and data;

存储器704,用于存储计算机执行指令;Memory 704, used to store computer-executable instructions;

处理器703,用于执行存储器704存储的计算机执行指令,以实现上述实施例中网络访问通道的建立的训练方法所执行的各个步骤。具体可以参见前述网络访问通道的建立的训练方法实施例中的相关描述。The processor 703 is used to execute the computer-executable instructions stored in the memory 704 to implement the various steps executed by the training method for establishing a network access channel in the above embodiment. For details, please refer to the relevant description in the above embodiment of the training method for establishing a network access channel.

可选地,上述存储器704既可以是独立的,也可以跟处理器703集成在一起。Optionally, the memory 704 may be independent or integrated with the processor 703 .

当存储器704独立设置时,该电子设备还包括总线,用于连接存储器704和处理器703。When the memory 704 is independently provided, the electronic device further includes a bus for connecting the memory 704 and the processor 703 .

本申请还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当处理器执行计算机执行指令时,实现如上述网络访问通道的建立的训练设备所执行的网络访问通道的建立的训练方法。The present application also provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, a training method for establishing a network access channel as performed by the training device for establishing a network access channel as described above is implemented.

本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules/units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

至此,已经结合附图所示的优选实施方式描述了本申请的技术方案,但是,本领域技术人员容易理解的是,本申请的保护范围显然不局限于这些具体实施方式,以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments, and the above embodiments are only used to illustrate the technical solution of the present application rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solution to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims (12)

1. A method for establishing a network access channel, applied to a terminal device, the method comprising:
Obtaining local area network information of terminal equipment, wherein the local area network information comprises: an IP address;
detecting whether the IP address changes in real time, and determining a new IP address of the terminal equipment when the IP address changes;
Generating an address changing instruction according to the new IP address, and sending the address changing instruction to a signaling server so that the signaling server forwards the address changing instruction to a proxy server;
And acquiring a remote access address sent by the signaling server, and establishing a network access channel according to the remote access address.
2. The method of claim 1, wherein prior to the obtaining the local area network information of the terminal device, the method further comprises:
acquiring a first running state of terminal equipment, starting HTTP interface service when the target running state is a first starting state, and sending a first connection request to the signaling server so that the signaling server establishes a first MQTT connection relation according to the first connection request.
3. The method of claim 1, wherein after establishing a network access channel based on the remote access address, the method further comprises:
Opening a network access channel and an access timer, and updating the timing duration of the access timer, wherein the access timer is used for recording the opening duration of the network access channel;
judging whether the current timing duration of the access timer is a preset idle timeout duration or not;
If yes, closing the network access channel;
If not, judging whether the current timing time length reaches a preset use time length, wherein the preset idle timeout time length is smaller than the preset use time length;
And closing the network access channel when the current timing duration reaches the preset use duration.
4. A method for establishing a network access channel, applied to a proxy server, the method comprising:
acquiring an address changing instruction sent by a signaling server, and updating a first address memory of the proxy server according to the address changing instruction;
Acquiring target query information sent by a client, and determining a target query result according to the target query information and the first address memory;
Sending the target query result to the signaling server so that the signaling server forwards the target query result to the client;
Acquiring a network channel creation instruction sent by the client, and generating a remote access address according to the network channel creation instruction;
and sending the remote access address to the signaling server so that the signaling server forwards the remote access address to the terminal equipment and the client respectively.
5. A method for establishing a network access channel, applied to a client, the method comprising:
Acquiring a second running state of the client, sending target query information to the proxy server when the second running state is a second starting state, and sending a second connection request to the signaling server so that the signaling server establishes a second MQTT connection relation according to the second connection request;
Acquiring a target query result sent by the signaling server, and updating a second address memory of the client according to the target query result;
Acquiring a current network environment of the client, and generating a network channel creation instruction according to a mobile network environment when the current network environment is the mobile network environment;
And sending the network channel creation instruction to the proxy server so that the proxy server establishes a network access channel according to the network channel creation instruction.
6. The method of claim 5, wherein the method further comprises:
when the current network environment is a Wi-Fi network environment, detecting the second address memory by adopting a target detection mode to obtain a target detection result, wherein the target detection result is used for indicating whether the client and the terminal equipment are in the same local area network or not;
And when the address detection result indicates that the client and the terminal equipment are not in the same local area network, generating the network channel creation instruction according to the Wi-Fi network environment.
7. The method of claim 6, wherein after generating the network channel creation instruction according to the current network environment, the method further comprises:
And acquiring a remote access address sent by the signaling server, and storing the remote access address so that the client can remotely access the terminal equipment according to the remote access address.
8. A device for establishing a network access channel, which is applied to a terminal device, and comprises:
The acquisition module is used for acquiring local area network information of the terminal equipment, wherein the local area network information comprises: an IP address;
The detection module is used for detecting whether the IP address is changed or not in real time;
A determining module, configured to determine a new IP address of the terminal device when the IP address changes;
the generation module is used for generating an address changing instruction according to the new IP address;
the sending module is used for sending the address changing instruction to a signaling server so that the signaling server forwards the address changing instruction to a proxy server;
the acquisition module is further used for acquiring a remote access address sent by the signaling server;
The establishing module is used for establishing a network access channel according to the remote access address.
9. A device for establishing a network access channel, which is applied to a proxy server, and comprises:
the acquisition module is used for acquiring the address changing instruction sent by the signaling server;
the processing module is used for updating the first address memory of the proxy server according to the address changing instruction;
The acquisition module is also used for acquiring target query information sent by the client;
The determining module is used for determining a target query result according to the target query information and the first address memory;
the sending module is used for sending the target query result to the signaling server so that the signaling server forwards the target query result to the client;
The acquisition module is further used for acquiring a network channel creation instruction sent by the client;
The generation module is used for generating a remote access address according to the network channel creation instruction;
The sending module is further configured to send the remote access address to the signaling server, so that the signaling server forwards the remote access address to the terminal device and the client respectively.
10. The device for establishing the network access channel is characterized by being applied to a client and comprising the following components:
The acquisition module is used for acquiring a second running state of the client;
the sending module is used for sending target query information to the proxy server and sending a second connection request to the signaling server when the second running state is a second starting state, so that the signaling server establishes a second MQTT connection relation according to the second connection request;
the acquisition module is further used for acquiring a target query result sent by the signaling server;
The processing module is used for updating the second address memory of the client according to the target query result;
the acquisition module is further used for acquiring the current network environment of the client;
The generation module is used for generating a network channel creation instruction according to the mobile network environment when the current network environment is the mobile network environment;
And the sending module is also used for sending the network channel creation instruction to the proxy server so that the proxy server establishes a network access channel according to the network channel creation instruction.
11. A network access channel establishment apparatus, comprising:
A memory;
A processor;
wherein the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of establishing a network access channel as claimed in any one of claims 1to 7.
12. A computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, which when executed by a processor is adapted to implement the method for establishing a network access channel according to any of claims 1-7.
CN202410210935.6A 2024-02-26 2024-02-26 Method, device, equipment and storage medium for establishing network access channel Pending CN118075331A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410210935.6A CN118075331A (en) 2024-02-26 2024-02-26 Method, device, equipment and storage medium for establishing network access channel

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410210935.6A CN118075331A (en) 2024-02-26 2024-02-26 Method, device, equipment and storage medium for establishing network access channel

Publications (1)

Publication Number Publication Date
CN118075331A true CN118075331A (en) 2024-05-24

Family

ID=91098466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410210935.6A Pending CN118075331A (en) 2024-02-26 2024-02-26 Method, device, equipment and storage medium for establishing network access channel

Country Status (1)

Country Link
CN (1) CN118075331A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118764535A (en) * 2024-09-09 2024-10-11 恒生电子股份有限公司 Data transmission method and system
CN119135415A (en) * 2024-09-13 2024-12-13 江苏慧铭信息科技有限公司 A remote control method and system based on network communication
CN120499199A (en) * 2025-07-16 2025-08-15 济南浪潮数据技术有限公司 Data synchronization method, device, electronic device and computer-readable storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118764535A (en) * 2024-09-09 2024-10-11 恒生电子股份有限公司 Data transmission method and system
CN119135415A (en) * 2024-09-13 2024-12-13 江苏慧铭信息科技有限公司 A remote control method and system based on network communication
CN120499199A (en) * 2025-07-16 2025-08-15 济南浪潮数据技术有限公司 Data synchronization method, device, electronic device and computer-readable storage medium
CN120499199B (en) * 2025-07-16 2025-09-19 济南浪潮数据技术有限公司 Data synchronization method, device, electronic device and computer-readable storage medium

Similar Documents

Publication Publication Date Title
TWI675572B (en) Network service system and network service method
CN118075331A (en) Method, device, equipment and storage medium for establishing network access channel
CN104429037B8 (en) Method, equipment and system for being connected to communication equipment
EP3720100A1 (en) Service request processing method and device
US20120136945A1 (en) Terminal and intermediate node in content oriented networking environment and communication method of terminal and intermediate node
CN113328972B (en) Equipment monitoring method, device, equipment and storage medium
TWI674780B (en) Network service system and network service method
KR102838527B1 (en) Method and apparatus for managing an identifier of a terminal in edge computing service
JP2012080418A (en) Management of terminal connection state in network authentication
US20080133723A1 (en) Extended home service apparatus and method for providing extended home service on p2p networks
US11368994B1 (en) Process for managing reconnections of devices in a network
CA2774281C (en) User access method, system, access server, and access device
WO2021165416A1 (en) Method for delivering an audio and/or video content in a mobile network infrastructure
EP2693691B1 (en) Method and apparatus for initializing gateway in device management system
US9191312B2 (en) Method and system for implementing PW control bit capability negotiation
KR20240168414A (en) Dual network casting system
CN102598637B (en) Communication Systems
US9661083B1 (en) Efficient notification protocol through firewalls
US20120300776A1 (en) Method for creating virtual link, communication network element, and ethernet network system
CN116192797B (en) Address request message answering method and device, electronic equipment and storage medium
CN1996964A (en) Method, system, terminal, GDXS, and GDXTS for data transfer between terminals
US10505892B2 (en) Method for transmitting at least one IP data packet, related system and computer program product
CN102655475B (en) Mobile communication switching method, device and system
EP2550836B1 (en) Method and apparatus for home network access
EP2891299A1 (en) Systems and methods for efficient remote security panel configuration and management

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