Communication connection method and apparatus, electronic device, system, and readable storage medium

By dividing the idle ports of local devices and building communication connections based on port guessing operations, the problem of device availability and connection success rate when IoT terminals are connected is solved, and more efficient port resource management and communication stability are achieved.

WO2024212573A1PCT designated stage expired Publication Date: 2024-10-17ZHEJIANG UNIVIEW TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/139474
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-14
Filing Date
2023-12-18
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

It is difficult to balance device availability and communication connection success rate when implementing the access of IoT terminals with existing technology, especially in the case of a combination of port-restricted conical NAT and symmetrical NAT, which leads to difficulty in communication connection.

Method used

By dividing the number of idle ports of the local device into selected ports and reserved ports, port guessing operations are performed based on the selected ports, different communication connections are constructed in case of success and failure, and port release time parameters are used to optimize port resource management to ensure that customers Session connection between terminal and local device.

Benefits of technology

It improves the success rate of communication connections, avoids excessive port consumption and frequent online and offline problems of the device, and ensures device availability and communication stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023139474_17102024_PF_FP_ABST
    Figure CN2023139474_17102024_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of communications, and provided thereby are a communication connection method and apparatus, an electronic device, a system, and a readable storage medium. The method comprises: on the basis of a first communication connection request initiated by a first client terminal, dividing the quantity of first idle ports of a network connection device corresponding to a local device into a quantity of first selected ports and a quantity of first reserved ports; on the basis of the quantity of first selected ports, executing a port guessing operation, and when the port guessing is successful, building a first communication connection between the first client terminal and the local device; and when the port guessing fails, building a second communication connection between the first client terminal and the local device on the basis of the quantity of first reserved ports.
Need to check novelty before this filing date? Find Prior Art

Description

Communication connection method, device, electronic device, system and readable storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This disclosure claims priority to Chinese patent application number 202310411853.3, filed on April 14, 2023, and entitled “Communication connection method, device, electronic device, system and readable storage medium,” which is incorporated herein by reference in its entirety. Technical Field

[0003] The present disclosure relates to the field of communication technologies, and in particular to a communication connection method, device, electronic device, system, and readable storage medium. Background Art

[0004] At present, NAT (Network Address Translation) traversal technology is applied to the access solution of IoT terminals to achieve mapping of different private network addresses to different ports of the same public network address, so that multiple hosts in the intranet can use the same IP (Internet Protocol) address to connect to the Internet, thus solving the problem of difficulty in physical network terminal access caused by the shortage of network addresses and the continuous increase of routing tables.

[0005] Because different hosts have different NAT networking types, the NAT traversal methods used are also different. When the two ends of the connection are a combination of port-restricted cone NAT and symmetric NAT, port guessing is often required to achieve communication connections between different hosts.

[0006] Summary of the Invention

[0007] The present disclosure provides a communication connection method, apparatus, electronic device, system and readable storage medium to solve the technical problem of how to ensure the availability of equipment and improve the success rate of communication connection in the prior art.

[0008] The present disclosure provides a communication connection method, comprising:

[0009] Based on a first communication connection request initiated by a first client terminal, dividing a first number of idle ports of a network connection device corresponding to the local device into a first number of selected ports and a first number of reserved ports;

[0010] performing a port guessing operation based on the first selected port number, and establishing a first communication connection between the first client terminal and the local device if the port guessing is successful;

[0011] In the case that the port guessing fails, a second communication connection is established between the first client terminal and the local device based on the first reserved port number.

[0012] According to a communication connection method provided by the present disclosure, the method further includes:

[0013] Sending a port information acquisition request to a network connection device corresponding to the local device, the local device being communicatively connected to the network connection device, the network connection device including a router and / or a switch;

[0014] Receive network port information sent by the network connection device, where the network port information includes the number of the first idle ports.

[0015] According to a communication connection method provided by the present disclosure, the network port information further includes a port release time parameter, and the port release time parameter includes a release duration of a single network port in the network connection device;

[0016] The method further includes: when the port guessing operation is completed, performing a port releasing operation based on the port releasing time parameter.

[0017] According to a communication connection method provided by the present disclosure, the method further includes:

[0018] If the port release operation is not completed and a second communication connection request initiated by a second client terminal is received, determining whether the second client terminal has a communication connection with the local device;

[0019] In a case where no communication connection exists between the second client terminal and the local device, a second communication connection is established between the second client terminal and the local device based on the first reserved port number.

[0020] According to a communication connection method provided by the present disclosure, the method further includes:

[0021] When the port release operation is completed, obtaining the number of second idle ports and a port release time parameter corresponding to the network connection device;

[0022] Initiating a port guessing request to a target client terminal based on the second number of idle ports, and performing a port guessing operation, wherein the target client terminal is a client terminal that initiates a communication connection request to the local device for the first time or the most recent time;

[0023] If the port guessing is successful, establishing a first communication connection between the target client terminal and the local device;

[0024] In the case of determining that the port guessing fails, the port release operation is repeatedly performed based on the port release time parameter, and after the port release operation is completed, the port guessing operation is repeatedly performed.

[0025] According to a communication connection method provided by the present disclosure, performing a port guessing operation based on the first selected port number includes:

[0026] Determine the first selected port number as the first port guess number corresponding to the local device;

[0027] sending the first port guess number to a server, so that the server determines a second port guess number based on the first port guess number and a preset port guessing strategy, and sends the second port guess number to the first client terminal; the second port guess number instructs the first client terminal to send a second port guess message to the network port in the network connection device;

[0028] Sending a first port guess message to a network port in the network connection device based on the first port guess number;

[0029] When the second port guessing message sent by the first client terminal or the response message corresponding to the first port guessing message is received, it is determined that the port guessing is successful, and the response message represents a response message sent by the first client terminal after receiving the first port guessing message.

[0030] The present disclosure also provides a communication connection device, comprising:

[0031] a port division module configured to divide a first number of idle ports of a network connection device corresponding to the local device into a first number of selected ports and a first number of reserved ports based on a first communication connection request initiated by the first client terminal;

[0032] a port guessing module configured to perform a port guessing operation based on the first selected port number, and establish a first communication connection between the first client terminal and the local device if the port guessing is successful;

[0033] The communication connection module is configured to establish a second communication connection between the first client terminal and the local device based on the first reserved port number when the port guessing fails.

[0034] The present disclosure also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the communication connection method as described above is implemented.

[0035] The present disclosure further provides a communication connection system, comprising: the electronic device as described in any one of the above, at least two client terminals, a network connection device, and a server, wherein:

[0036] The electronic device is connected to the network connection device, and the network connection device is connected to the server;

[0037] The at least two client terminals include a first client terminal and a second client terminal, and both the first client terminal and the second client terminal are connected to the server through the network connection device.

[0038] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements any of the above-described communication connection methods when executed by a processor.

[0039] The present disclosure also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the above-described communication connection methods.

[0040] The communication connection method, apparatus, electronic device, system and readable storage medium provided by the present disclosure divide the first number of idle ports of the network connection device corresponding to the local device into a first number of selected ports and a first number of reserved ports, and perform a port guessing operation based on the first number of selected ports. If the port guessing is successful, a first communication connection is established between the first client terminal and the local device; and if the port guessing fails, a second communication connection is established between the first client terminal and the local device based on the first number of reserved ports, that is, the reserved network port is used to ensure that the client terminal can establish a session connection with the local device. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] FIG1 is a flow chart of a communication connection method according to an embodiment of the present disclosure;

[0042] FIG2 is a second flow chart of the communication connection method provided in an embodiment of the present disclosure;

[0043] FIG3 is a third flow chart of the communication connection method provided in an embodiment of the present disclosure;

[0044] FIG4 is a fourth flow chart of the communication connection method provided in an embodiment of the present disclosure;

[0045] FIG5 is a fifth flow chart of the communication connection method provided in an embodiment of the present disclosure;

[0046] FIG6 is a schematic structural diagram of a communication connection device provided in an embodiment of the present disclosure;

[0047] FIG7 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure;

[0048] FIG8 is a schematic structural diagram of a communication connection system provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0049] The technical solutions in the present disclosure will be described below in conjunction with the drawings in the present disclosure. The described embodiments are only part of the embodiments of the present disclosure, but not all of the embodiments.

[0050] The following describes the communication connection method provided by the present disclosure in conjunction with Figures 1 to 5. As shown in Figure 1, the present disclosure provides a communication connection method, including:

[0051] Step 101 : Based on a first communication connection request initiated by a first client terminal, a first idle port number of a network connection device corresponding to a local device is divided into a first selected port number and a first reserved port number.

[0052] The first communication connection request indicates a request by the first client terminal to establish a communication connection with the local device, i.e., a communication connection request proactively initiated by the first client terminal to the local device. The local device may be a monitoring device or other electronic device. For example, the local device may be a monitoring device, and the first client terminal may be a client terminal used to browse or manage video data collected by the monitoring device.

[0053] Furthermore, the sum of the first number of selected ports and the first number of reserved ports is the first number of idle ports. If the first number of idle ports is represented as D and the first number of selected ports can be represented as n, then the first number of reserved ports can be represented as n1=Dn.

[0054] Furthermore, the first number of available ports represents the number of currently available ports of the network connection device. The first selected number of ports is used to perform a port guessing operation to establish a first communication connection between the first client terminal and the local device. The first reserved number of ports is used to establish a second communication connection between the first client terminal and the local device if port guessing fails.

[0055] Furthermore, when a first communication connection request initiated by a first client terminal is received and the communication connection type requested in the first communication connection request is a second communication connection, a second communication connection can be established between the first client terminal and the local device based on an idle port of the network connection device.

[0056] Step 102 : performing a port guessing operation based on the first selected port number, and establishing a first communication connection between the first client terminal and the local device if the port guessing is successful.

[0057] The first communication connection is a direct communication connection type, including a tunnel communication connection. The tunnel communication connection may also be called a point-to-point tunnel connection, which is a communication method for direct connection between devices.

[0058] Among them, the port guessing operation refers to the operation of the first client terminal and the local device guessing the network port selected by the other party. In essence, it is a random collision operation of the communication connection, which can realize the communication connection under the conditions of different NAT networking types of different hosts, especially the "port restriction cone type" and "symmetric type" combinations.

[0059] It should be noted that, in the first communication connection mode, the first client terminal and the local device can perform end-to-end communication without the need for data forwarding by the server.

[0060] Step 103: If the port guessing fails, establish a second communication connection between the first client terminal and the local device based on the first reserved port number.

[0061] The second communication connection is an indirect communication connection type, including a distribution communication connection and a forwarding communication connection.

[0062] It should be noted that, in the second communication connection mode, the first client terminal and the local device cannot directly communicate end-to-end. For example, when the second communication connection is a forwarding communication connection, data forwarding by the server is required to achieve communication between the two parties.

[0063] The above steps 101 to 103 divide the first number of free ports of the network connection device corresponding to the local device into a first number of selected ports and a first number of reserved ports, and perform a port guessing operation based on the first number of selected ports. When the port guessing is successful, a first communication connection is established between the first client terminal and the local device; and when the port guessing fails, a second communication connection is established between the first client terminal and the local device based on the first number of reserved ports. That is, the reserved network port is used to ensure that the client terminal can establish a session connection with the local device, thereby avoiding a single client terminal consuming too many ports, resulting in the device being offline, frequently online and offline, and unable to start live broadcasts, and other functions being unavailable, thereby solving the technical problem in the prior art of how to balance ensuring the availability of the device and improving the success rate of the communication connection.

[0064] Furthermore, the first selected port number is greater than the first reserved port number, so that on the basis of ensuring that a sufficient number of network ports are reserved for establishing session connections, as many network ports as possible are used for port guessing to further improve the success rate of the first communication connection.

[0065] In one embodiment, when a first communication connection request initiated by a first client terminal is received and the communication connection type requested in the first communication connection request is a first communication connection type, the first idle port number of the network connection device corresponding to the local device is divided into a first selected port number and a first reserved port number, and steps 102 to 103 are executed.

[0066] Furthermore, when a first communication connection request initiated by a first client terminal is received and the communication connection type requested in the first communication connection request is a second communication connection type, subsequent steps are no longer executed and a second communication connection is directly established between the first client terminal and the local device.

[0067] In one embodiment, as shown in FIG2 , the communication connection method provided by the present disclosure further includes the following steps:

[0068] Step 201: Send a port information acquisition request to a network connection device corresponding to a local device. The local device is in communication with the network connection device, which includes a router and / or a switch.

[0069] Furthermore, the local device sends a port information acquisition request to the corresponding network connection device to obtain the network port information corresponding to the current network connection device. The local device and its corresponding network connection device have a connection relationship, which can be a wired connection or a wireless connection.

[0070] Step 202: Receive network port information sent by a network connection device, where the network port information includes the number of first idle ports.

[0071] Furthermore, the network port information includes the number of the first idle port of the current network connection device. When the local device is in a multi-layer NAT network, the network port information is obtained from the router or switch connected to the local device step by step upward to obtain the network port information of the network connection device in the direct link where the local device is located in the network topology.

[0072] Furthermore, the first idle port number D is the minimum number of idle ports of each node in the direct link where the local device is located, and the port release time parameter T is the maximum value of the port release time parameter of each node in the direct network link where the local device is located.

[0073] In the above steps 201 to 202, a port information acquisition request is sent to the network connection device corresponding to the local device to obtain the network port information of the current network connection device in real time to ensure the timeliness and reliability of the network port information, and then perform port division and port guessing based on the latest network port information to ensure the availability of the device and improve the success rate of the communication connection.

[0074] In one embodiment, the network port information further includes a port release time parameter, which includes a release duration of a single network port in the network connection device. The communication connection method provided by the present disclosure further includes the following steps: when the port guessing operation is completed, performing a port release operation based on the port release time parameter.

[0075] Specifically, a target port release duration is determined based on the release duration of a single network port in the port release time parameter and the first selected number of ports, and ports of the network segment of the first selected number of ports are released within the target port release duration. The target port release duration represents the total port release duration of the network segment of the first selected number of ports.

[0076] The above embodiment, after completing the port guessing operation, performs a port release operation based on the port release time parameter to recover the consumed port resources, and indicates that the port release operation is currently in progress and the port guessing operation cannot be performed normally, so as to prompt the local device to establish a session connection with the client terminal based on other communication connection methods, thereby further ensuring the availability of the device and improving the success rate of the communication connection.

[0077] In one embodiment, as shown in FIG3 , the communication connection method provided by the present disclosure further includes the following steps:

[0078] Step 301 : When the port release operation is not completed and a second communication connection request initiated by a second client terminal is received, it is determined whether the second client terminal has a communication connection with the local device.

[0079] The second client terminal may be the original first client terminal, or may be another client terminal other than the first client terminal.

[0080] It should be noted that the original first client terminal may proactively disconnect after initially establishing the second communication connection with the local device and then initiate a second communication connection request to the local device again to request the establishment of the first communication connection with the local device. Other client terminals may initiate a second communication connection request to the local device for the first time to request the establishment of the first communication connection with the local device.

[0081] Step 302 : When there is no communication connection between the second client terminal and the local device, establish a second communication connection between the second client terminal and the local device based on the first reserved port number.

[0082] For example, the number of first reserved ports is three. On the basis of establishing a second communication connection between the first client terminal and the local device based on the first reserved port, a second communication connection between the second client terminal and the local device can also be established based on the second reserved port. Furthermore, a second communication connection between the third client terminal and the local device can also be established based on the third reserved port.

[0083] In the above steps 301 to 302, when the port release operation is not completed and a second communication connection request initiated by the second client terminal is received, it is determined whether the second client terminal has a communication connection with the local device. When no communication connection exists between the second client terminal and the local device, a second communication connection is established between the second client terminal and the local device based on the first reserved port number to ensure that all client terminals that initiate communication connection requests to the local device can establish a session connection with the local device, thereby avoiding a single client terminal consuming too many ports, resulting in other client terminals being unable to establish a session connection with the local device, thereby further improving the availability of the device and the success rate of the communication connection.

[0084] In one embodiment, as shown in FIG4 , the communication connection method provided by the present disclosure further includes the following steps:

[0085] Step 401: When the port release operation is completed, the number of second idle ports and the port release time parameter corresponding to the network connection device are obtained.

[0086] The second idle port quantity represents the number of current idle ports of the network connection device after the port release operation is completed.

[0087] Specifically, a current release wait time is obtained, and it is determined whether the current release wait time is greater than the target port release time. If the current release wait time is greater than or equal to the target port release time, the port release operation is determined to be completed. The current release wait time represents the accumulated waiting time before the port release operation is completed, and can also be understood as the accumulated time of the port release operation execution.

[0088] The target port release duration is determined based on the release duration of a single network port in the port release time parameter and the first selected port quantity, and the first selected port quantity is determined based on the first idle port quantity of the network connection device.

[0089] Step 402: Initiate a port guessing request to a target client terminal based on the second number of idle ports and perform a port guessing operation. The target client terminal is a client terminal that initiates a communication connection request to the local device for the first time or the latest time.

[0090] Among them, "initiating a port guessing request to the target client terminal based on the second number of idle ports" means that the local device initiates a port guessing request to the target client terminal in reverse to establish a communication connection between the local device and the target client terminal. Therefore, it can also be understood as the local device initiating a second communication connection request to the target client terminal in reverse.

[0091] It should be noted that the first communication connection request in step 101 above represents a communication connection request initiated by the "first client terminal" to the "local device," while the second communication connection request here represents a communication connection request initiated by the "local device" to the "target client terminal." Because the "requester" and "requestee" in the first and second communication connection requests are interchanged, the first communication connection request can be referred to as a communication connection request "initiated" by the client terminal, while the second communication connection request can be referred to as a communication connection request "initiated" by the local device.

[0092] In one embodiment, the above step 402 specifically includes the following steps:

[0093] (1) Determine the second idle port number as the third port guess number corresponding to the local device, wherein the third port guess number (or the second idle port number) is used to perform a port guessing operation to establish a first communication connection between the target client terminal and the local device.

[0094] It should be noted that before the port guessing operation is performed for the first time, a sufficient number of idle ports have been reserved to ensure the establishment of a session connection between the client terminal and the local device. Therefore, when the port guessing operation is performed subsequently, all idle ports in the second number of idle ports can be used for port guessing, so as to invest as many network ports as possible for port guessing, thereby further improving the success rate of the first communication connection.

[0095] (2) sending the third port guess number to the server, so that the server determines the fourth port guess number based on the third port guess number and a preset port guessing strategy, and sends the fourth port guess number to the target client terminal; the fourth port guess number instructs the target client terminal to send a fourth port guess message to the network port in the network connection device.

[0096] (3) Sending a third port guess message to the network port in the network connection device based on the third port guess number.

[0097] (4) When the fourth port guessing message or the response message corresponding to the third port guessing message sent by the target client terminal is received, it is determined that the port guessing is successful. The response message indicates a response message sent by the target client terminal after receiving the third port guessing message.

[0098] It should be noted that when the local device receives the fourth port speculation message sent by the target client terminal, or the target client terminal receives the third port speculation message sent by the local device, it can be determined that the local device and the target client terminal send the port speculation message to the same network port in the network connection device, thereby determining that this port speculation is successful.

[0099] Step 403: If it is determined that the port guessing is successful, a first communication connection is established between the target client terminal and the local device.

[0100] Furthermore, the target client terminal is the client terminal that initiates the first or most recent communication connection request to the local device. For example, the target client terminal is the second client terminal that initiates the first communication connection request to the local device, where the second client terminal is a client terminal other than the first client terminal. The target client terminal is the first client terminal that initiates the most recent communication connection request to the local device, where the first client terminal has previously initiated a communication connection request to the local device.

[0101] Furthermore, “a client terminal that initiates a communication connection request to a local device for the first time” refers to a client terminal that has not previously initiated a communication connection request to a local device, that is, this is the first time that the client terminal initiates a communication connection request to a local device.

[0102] Furthermore, "the client terminal that has most recently initiated a communication connection request to the local device" means a client terminal that has previously initiated a communication connection request to the local device at least once, that is, this is the most recent time that the client terminal has initiated a communication connection request to the local device, and the total number of times that the client terminal has initiated a communication connection request to the local device is at least two, including at least one previous time and the most recent time (that is, this time).

[0103] Step 404: If it is determined that the port guessing fails, the port release operation is repeatedly performed based on the port release time parameter, and after the port release operation is completed, the port guessing operation is repeatedly performed.

[0104] In the above steps 401 to 404, after the port is released, the local device reversely initiates the port guessing process for the target client terminal, thereby maximizing the success rate of port guessing while ensuring network resources, and further improving the success rate of the first communication connection by repeating the port guessing multiple times.

[0105] In one embodiment, as shown in FIG5 , the step of performing the port guessing operation based on the first selected port number in step 102 specifically includes:

[0106] Step 501: Determine the first selected port quantity as the first guessed port quantity corresponding to the local device.

[0107] Step 502: Send the first port guess number to the server, so that the server determines the second port guess number based on the first port guess number and the preset port guess strategy, and sends the second port guess number to the first client terminal; the second port guess number instructs the first client terminal to send the second port guess message to the network port in the network connection device.

[0108] The first port guess number can be expressed as n, and the second port guess number can be expressed as m.

[0109] In one embodiment, the above step 502 specifically includes the following steps:

[0110] (1) The local device sends the first port guess number n to the server. The server receives the first port guess number n sent by the local device and obtains the NAT networking type corresponding to the first client terminal and the local device through detection.

[0111] (2) When the server determines that the NAT networking type combination of the first client terminal and the local device is a combination of "port restriction cone type" and "symmetric type", the server guesses the number n according to the first port corresponding to the local device and selects the target number combination with the highest collision success rate from multiple number combinations with different collision probabilities.

[0112] Furthermore, with Port Restricted NAT, all connection requests originating from the same private address X (including IP address and port number) are mapped to the same public address Y (including IP address and port number), regardless of the destination address of the request. However, NAT will forward the request from private address X to address Z (including IP address and port number) only if private address X first sends a request to public address Y through public address Y. Otherwise, the request from Z to X will be considered unauthenticated by NAT and blocked.

[0113] Furthermore, with symmetric NAT, connection requests from the same private address X are mapped to different public addresses (with different port numbers) depending on the destination address (including IP address and port number). NAT will forward the request from private address X to address Z (including IP address and port number) only if private address X first sends a request to public address Y. Otherwise, the request from Z to X will be considered unauthenticated by NAT and blocked.

[0114] (3) The server determines the second port guess number m corresponding to the first client terminal based on the target number combination and the first port guess number n, and sends the second port guess number m to the first client terminal.

[0115] For example, if the target number combination is n:m=3:5 and the first port guess number n is 300, then the second port guess number m can be determined to be 500.

[0116] Furthermore, the collision success rate corresponding to the target number combination can be expressed by the following formula (1): T = 1-[(1-m / 65536)*(1-m / (65536-1))…(1-m / (65536-n+1))] (1)

[0117] The number combination is n:m. The first port guesses the number n≤65536. The second port guesses the number m≤65536. The collision success rate corresponding to each number combination is T. When the first port guesses the number n, the collision success rate T varies depending on the second port guess m. The number combination with the highest collision success rate T is selected as the target number combination.

[0118] (4) The first client terminal receives the second port guess number m sent by the server, and sends a second port guess message to the network port in the network connection device based on the second port guess number m. The number of the second port guess message is the second port guess number m.

[0119] Step 503: Send a first port guess message to a network port in the network connection device based on the first port guess number.

[0120] The number of first port guessed messages is the first port guessed number n.

[0121] Step 504: upon receiving the second port guessing message sent by the first client terminal or a response message corresponding to the first port guessing message, it is determined that the port guessing is successful. The response message indicates a response message sent by the first client terminal after receiving the first port guessing message.

[0122] It should be noted that when the local device receives the second port prediction message sent by the first client terminal, or when the first client terminal receives the first port prediction message sent by the local device, it can be determined that the local device and the first client terminal sent the port prediction message to the same network port in the network connection device, thereby determining that the port prediction was successful. The specific port prediction process is a mature technical solution and is therefore not further described in this disclosure.

[0123] The communication connection method provided by the present disclosure has at least the following advantages: (1) when port guessing is performed for the first time, port guessing is performed after reasonable allocation of port resources; if port guessing fails, after subsequent port resource recovery, multiple port guessings can be performed on the basis of ensuring the existing connection to improve the success rate of tunnel connection.

[0124] (2) By dividing the current number of idle ports in the direct network to which the local device is connected into a first number of selected ports and a first number of reserved ports, performing port guessing based on the first number of selected ports, and performing a second communication connection based on the first number of reserved ports, excessive consumption of network ports is avoided.

[0125] (3) The local device releases the network ports involved in port guessing based on the port release time parameter to reclaim the port resources in a timely manner, and determines the best port guessing scheme based on the NAT networking type of the client terminal and the local device and the corresponding first port guessing number of the local device, and sends the second port guessing number in the best port guessing scheme to the corresponding client terminal to further improve the success rate of the first communication connection.

[0126] (4) After the port is released, the local device reversely initiates the port guessing process for the client terminal, maximizing the success rate of port guessing while ensuring network resources, and further improving the success rate of the first communication connection by repeating the port guessing multiple times.

[0127] The communication connection device provided by the present disclosure is described below. The communication connection device described below and the communication connection method described above can be referenced to each other.

[0128] As shown in FIG6 , the present disclosure provides a communication connection device, wherein the communication connection device 100 includes:

[0129] The port division module 1001 is configured to divide the first idle port number of the network connection device corresponding to the local device into a first selected port number and a first reserved port number based on the first communication connection request initiated by the first client terminal.

[0130] The port guessing module 1002 is configured to perform a port guessing operation based on the first selected port number, and establish a first communication connection between the first client terminal and the local device if the port guessing is successful.

[0131] The communication connection module 1003 is configured to establish a second communication connection between the first client terminal and the local device based on the first reserved port number when the port guessing fails.

[0132] In one embodiment, the communication connection device 100 also includes a port information acquisition module, which is configured to send a port information acquisition request to a network connection device corresponding to the local device, where the local device is communicatively connected to the network connection device, and the network connection device includes a router and / or a switch; and receive network port information sent by the network connection device, where the network port information includes the number of first idle ports.

[0133] In one embodiment, the network port information also includes a port release time parameter, which includes the release duration of a single network port in the network connection device; the communication connection device 100 also includes a port release module, which is configured to perform a port release operation based on the port release time parameter when the port guessing operation is completed.

[0134] In one embodiment, the communication connection device 100 also includes a forwarding connection module, which is configured to determine whether the second client terminal has a communication connection with the local device when the port release operation is not completed and a second communication connection request initiated by the second client terminal is received; when the second client terminal has no communication connection with the local device, establish a second communication connection between the second client terminal and the local device based on the first reserved port number.

[0135] In one embodiment, the port guessing module 1002 is further configured to obtain the second idle port number and port release time parameter corresponding to the network connection device when the port release operation is completed; initiate a port guessing request to the target client terminal based on the second idle port number, and perform a port guessing operation, where the target client terminal is the client terminal that initiates the first or most recent communication connection request to the local device; when it is determined that the port guessing is successful, establish a first communication connection between the target client terminal and the local device; when it is determined that the port guessing fails, repeat the port release operation based on the port release time parameter, and repeat the port guessing operation after completing the port release operation.

[0136] In one embodiment, the port guessing module 1002 is further configured to determine the first selected port number as the first port guessing number corresponding to the local device; send the first port guessing number to the server, so that the server determines the second port guessing number based on the first port guessing number and the preset port guessing strategy, and sends the second port guessing number to the first client terminal; the second port guessing number instructs the first client terminal to send a second port guessing message to the network port in the network connection device; send the first port guessing message to the network port in the network connection device based on the first port guessing number; when receiving the second port guessing message sent by the first client terminal or a response message corresponding to the first port guessing message, it is determined that the port guessing is successful, and the response message indicates a response message sent by the first client terminal after receiving the first port guessing message.

[0137] FIG7 illustrates a schematic diagram of the physical structure of an electronic device. As shown in FIG7 , the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call logic instructions in the memory 830 to execute the communication connection method provided by each of the above methods, which includes: based on a first communication connection request initiated by a first client terminal, dividing a first number of idle ports of a network connection device corresponding to a local device into a first number of selected ports and a first number of reserved ports; performing a port guessing operation based on the first number of selected ports, and if the port guessing is successful, establishing a first communication connection between the first client terminal and the local device; and if the port guessing fails, establishing a second communication connection between the first client terminal and the local device based on the first number of reserved ports.

[0138] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of each embodiment method of the present invention. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc., each of which can store program code.

[0139] As shown in FIG8 , the present disclosure further provides a communication connection system, comprising: the electronic device provided in each of the above embodiments, at least two client terminals, a network connection device, and a server, wherein:

[0140] The electronic device is connected to a network connection device, and the network connection device is connected to a server, wherein the network connection device includes a router and / or a switch.

[0141] The at least two client terminals include a first client terminal and a second client terminal (only the first client terminal and the second client terminal are shown in FIG8 ), and both the first client terminal and the second client terminal are connected to the server via a network connection device.

[0142] On the other hand, the present disclosure also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the communication connection method provided by each of the above methods, the method including: based on a first communication connection request initiated by a first client terminal, dividing the first number of idle ports of a network connection device corresponding to the local device into a first number of selected ports and a first number of reserved ports; performing a port guessing operation based on the first number of selected ports, and if the port guessing is successful, establishing a first communication connection between the first client terminal and the local device; if the port guessing fails, establishing a second communication connection between the first client terminal and the local device based on the first number of reserved ports.

[0143] On the other hand, the present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the communication connection method provided by each of the above methods, the method comprising: based on a first communication connection request initiated by a first client terminal, dividing the first number of idle ports of a network connection device corresponding to the local device into a first number of selected ports and a first number of reserved ports; performing a port guessing operation based on the first number of selected ports, and if the port guessing is successful, establishing a first communication connection between the first client terminal and the local device; if the port guessing fails, establishing a second communication connection between the first client terminal and the local device based on the first number of reserved ports.

[0144] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. That is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0145] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a non-transitory computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method of each embodiment or certain parts of the embodiment.

[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure 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 each of the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of each embodiment of the present disclosure.

Claims

1. A communication connection method, include: Based on a first communication connection request initiated by a first client terminal, dividing a first idle port number of a network connection device corresponding to the local device into a first selected port number and a first reserved port number; Performing a port guessing operation based on the first selected port number, and establishing a first communication connection between the first client terminal and the local device if the port guessing is successful; In the case where port guessing fails, a second communication connection is established between the first client terminal and the local device based on the first reserved port number.

2. The communication connection method according to claim 1, in, The method further comprises: Sending a port information acquisition request to a network connection device corresponding to the local device, the local device being communicatively connected with the network connection device, the network connection device comprising a router and / or a switch; The network port information sent by the network connection device is received, where the network port information includes the first idle port quantity.

3. The communication connection method according to claim 2, in, The network port information also includes a port release time parameter, and the port release time parameter includes a release duration of a single network port in the network connection device; The method further includes: when the port guessing operation is completed, performing a port releasing operation based on the port releasing time parameter.

4. The communication connection method according to claim 3, in, The method further comprises: When the port release operation is not completed and a second communication connection request initiated by a second client terminal is received, determining whether the second client terminal has a communication connection with the local device; In a case where there is no communication connection between the second client terminal and the local device, a second communication connection between the second client terminal and the local device is established based on the first reserved port number.

5. The communication connection method according to claim 3, in, The method further comprises: When the port release operation is completed, the second The number of idle ports and the port release time parameters; Initiating a port guessing request to a target client terminal based on the second number of free ports, and performing a port guessing operation, wherein the target client terminal is a client terminal that initiates a communication connection request to the local device for the first time or most recently; If it is determined that the port guessing is successful, establishing a first communication connection between the target client terminal and the local device; In the case of determining that the port guessing fails, the port release operation is repeatedly performed based on the port release time parameter, and after the port release operation is completed, the port guessing operation is repeatedly performed.

6. The communication connection method according to any one of claims 1 to 5, in, The performing a port guessing operation based on the first selected port quantity includes: Determine the first selected port quantity as the first port guess quantity corresponding to the local device; The first port guessing number is sent to a server, so that the server determines a second port guessing number based on the first port guessing number and a preset port guessing strategy, and sends the second port guessing number to the first client terminal; the second port guessing number instructs the first client terminal to send a second port guessing message to the network port in the network connection device; Sending a first port guess message to a network port in the network connection device based on the first port guess number; When the second port guessing message sent by the first client terminal or the response message corresponding to the first port guessing message is received, it is determined that the port guessing is successful, and the response message represents the response message sent by the first client terminal after receiving the first port guessing message.

7. A communication connection device, include: A port division module configured to divide the first idle port number of the network connection device corresponding to the local device into a first selected port number and a first reserved port number based on the first communication connection request initiated by the first client terminal; The port guessing module is configured to perform a port guessing operation based on the first selected port number, and if the port guessing is successful, establish a first connection between the first client terminal and the local device. a communication connection; The communication connection module is configured to establish a second communication connection between the first client terminal and the local device based on the first reserved port number when the port guessing fails.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the communication connection method according to any one of claims 1 to 6 when executing the program.

9. A communication connection system, include: The electronic device, at least two client terminals, a network connection device, and a server as claimed in claim 8, wherein: The electronic device is connected to the network connection device, and the network connection device is connected to the server; The at least two client terminals include a first client terminal and a second client terminal, and both the first client terminal and the second client terminal are connected to the server via the network connection device.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the communication connection method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Symmetrical NAT traversal method and system based on big data analysis

    CN105141711A

  • Penetrating method and device of symmetric NAT

    CN107580082A

  • A peer-to-peer network connection method and related devices

    CN109274735A

  • Tunnel connection method and device, electronic equipment and storage medium

    CN115914164A

  • Method, device and system for establishing point-to-point link

    CN115941641A