Network setting method, network setting device and electronic equipment
By acquiring and utilizing the real-time bandwidth margin of multiple communication networks, intelligently setting the egress network of the communication link, solving the problem of insufficient flexibility and intelligence of gateway equipment in the existing technology in the egress network settings, and improving network stability and resource utilization improve bandwidth and throughput.
Patent Information
- Application Number
- CN202111254080.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-27
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-10-27
AI Technical Summary
Existing gateway devices lack flexibility and intelligence in the egress network settings, resulting in data loss during network switching, affecting user experience, and inefficient resource utilization.
By obtaining the real-time bandwidth margin of at least two communication networks, determining the target communication network that meets the preset bandwidth conditions and setting it as the exit network of the communication link, the exit network of each newly created communication link is achieved independently. Improve network stability and resource utilization.
Without affecting the original communication link, setting up an exit network for each newly built communication link improves the stability and overall bandwidth of the network, maximizes the use of the resources of each communication network, and improves network throughput and flexibility sex.
Smart Images

Figure CN113839822B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular, relates to a network setting method, a network setting device, an electronic device, and a computer-readable storage medium. Background Art
[0002] At present, most gateway devices need to be connected to the Internet in real time and upload the collected data to the cloud, which has high requirements for the continuous transmission of data. Therefore, the current gateway devices need multiple Internet access methods to back up each other. Otherwise, once the performance of the export network used by the gateway device fluctuates or decreases (such as bandwidth reduction), it will cause frequent loss of data to be transmitted. The network switching method of the existing gateway device is relatively simple. It usually detects the signal strength and rate of the interface and other parameters first, and then judges whether these parameters meet the switching conditions according to a preset threshold. After the parameters meet the switching conditions, all communication links are switched to another export network as a whole. It can be imagined that when switching the export network, all communication links need to be terminated first, which will still cause the loss of data being transmitted, causing great inconvenience to users. That is, the current gateway device still has the problem of insufficient flexibility and intelligence in the setting of the export network. Summary of the invention
[0003] The present application provides a network setting method, a network setting device, an electronic device and a computer-readable storage medium, which can intelligently and flexibly implement the setting of an egress network.
[0004] In a first aspect, the present application provides a network setting method, which is applied to an electronic device having at least two communication networks, and the network setting method includes:
[0005] When a new communication link is established, respectively obtaining the real-time bandwidth margins of the at least two communication networks;
[0006] Determining a target communication network from the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition;
[0007] The target communication network is set as the egress network of the communication link.
[0008] In a second aspect, the present application provides a network setting device, which is applied to an electronic device having at least two communication networks, and includes:
[0009] An acquisition module, used to respectively acquire the real-time bandwidth margins of the at least two communication networks when a new communication link is established;
[0010] A determination module, configured to determine a target communication network from among the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition;
[0011] The setting module is used to set the above-mentioned target communication network as the egress network of the above-mentioned communication link.
[0012] In a third aspect, the present application provides 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 steps of the method of the first aspect when executing the computer program.
[0013] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method of the first aspect are implemented.
[0014] In a fifth aspect, the present application provides a computer program product, which includes a computer program. When the computer program is executed by one or more processors, it implements the steps of the method of the first aspect.
[0015] Compared with the prior art, the present application has the following beneficial effects: when the electronic device creates a new communication link, it will first obtain the real-time bandwidth margins of at least two communication networks respectively, and then determine the target communication network in the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies the preset bandwidth condition, and finally sets the target communication network as the exit network of the communication link. It can be seen from the above process that the exit network of each newly created communication link is independently set based on the real-time bandwidth margin of each current communication network, which enables each newly created communication link to set the exit network without affecting the original communication link, thereby improving the stability of the network. Moreover, compared with the network setting scheme in the prior art in which all communication links of the device are set to the same exit network by selecting one of two or selecting one of N, the present application scheme can maximize the use of the resources of each communication network, which helps to improve the overall bandwidth and network throughput. It can be understood that the beneficial effects of the second to fifth aspects mentioned above can refer to the relevant description in the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 It is a schematic diagram of the implementation flow of the network setting method provided in the embodiment of the present application;
[0018] Figure 2 is a schematic diagram of a specific implementation flow of step 102 provided in an embodiment of the present application;
[0019] Figure 3 This is a schematic diagram of a specific implementation process of an electronic device obtaining the current real-time bandwidth margin of a communication network provided by an embodiment of the present application;
[0020] Figure 4 It is a schematic diagram of the calculation process of the real-time bandwidth margin provided by the embodiment of the present application;
[0021] Figure 5 is a structural block diagram of a network setting device provided in an embodiment of the present application;
[0022] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0024] In order to illustrate the technical solution proposed in this application, a specific embodiment is provided below for illustration.
[0025] The network setting method proposed in the embodiment of the present application is explained below. The network setting method is applied to an electronic device in which there are at least two communication networks. As an example only, the electronic device may be an intelligent gateway, and the communication network may include a wireless communication network and a wired communication network. Among them, the wireless communication network may include but is not limited to a WI-FI network, a 4G network and a 5G network; the wired communication network may include but is not limited to an Ethernet network, a serial port network and a fiber optic network. It can be understood that as long as a network can access the Internet, it can be regarded as a communication network. That is, the electronic device targeted by the embodiment of the present application should be equipped with interfaces of at least two different communication networks so that the electronic device can access the Internet through different communication networks.
[0026] See also Figure 1 , the implementation process of the network setting method is detailed as follows:
[0027] Step 101, when a new communication link is established, respectively obtaining the real-time bandwidth margins of the at least two communication networks.
[0028] In the embodiment of the present application, the upper layer specific service of the electronic device will decide whether to establish a new communication link according to the received communication request or the actual communication situation of each established communication link. Specifically, the communication link is mainly a data link encapsulated in the form of Internet Protocol (IP) packets, including but not limited to Transmission Control Protocol (TCP) links and User Datagram Protocol (UDP) links.
[0029] As an example only, when the upper-layer specific service receives a communication request sent by a user or other device, that is, when the upper-layer specific service determines that there is a new communication demand, a new communication link can be created; or, when the egress network of an established communication link is disconnected, the upper-layer specific service corresponding to the communication link will also create a new communication link again to replace the communication link that is disconnected from the egress network.
[0030] It is understandable that each step of the embodiment of the present application is triggered when the electronic device creates a new communication link. When creating a new communication link, whether it is a new communication link is identified based on whether the five-tuple (source IP, destination IP, protocol type, source port and destination port) of the TCP or UDP data packet is consistent.
[0031] When a new communication link is established, the electronic device can be automatically triggered to perform operations to obtain the current real-time bandwidth margins of at least two communication networks. It can be understood that for each communication network, the current real-time bandwidth margin of the communication network can be determined according to the current working state of the communication network and the current network parameters.
[0032] Step 102, determining a target communication network among the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition.
[0033] In the embodiment of the present application, in order to ensure the service quality of the newly established communication link and avoid communication anomalies in the communication link, the target communication network can be determined according to the current real-time bandwidth margin of each communication network. Specifically, the electronic device has pre-set bandwidth conditions, and only when the real-time bandwidth margin meets the bandwidth condition, the communication network corresponding to the real-time bandwidth margin can be determined as the target communication network.
[0034] In some embodiments, the electronic device may also pre-set the priority of each communication network according to the user's usage requirements; the electronic device may then determine whether the communication network is the target communication network in descending order of priority. Figure 2 , the step 102 can be specifically performed as follows:
[0035] A1. Obtain the priorities of the at least two communication networks respectively.
[0036] A2. Based on the order of the above priorities from high to low, determine in turn whether the real-time bandwidth margin of the communication network meets the above preset bandwidth condition, and stop determining when a communication network whose real-time bandwidth margin meets the above preset bandwidth condition is obtained.
[0037] A3. Determine the communication network whose real-time bandwidth margin meets the preset bandwidth condition as the target communication network.
[0038] The above process can be understood as: the electronic device first determines the communication network with the highest priority as the communication network to be tested; then it can be determined whether the real-time bandwidth margin of the communication network to be tested meets the preset bandwidth condition; if the real-time bandwidth margin of the communication network to be tested meets the preset bandwidth condition, the communication network to be tested is determined as the target communication network; conversely, if the real-time bandwidth margin of the communication network to be tested does not meet the preset bandwidth condition, then based on the order of priority from high to low, a new communication network to be tested is determined from the at least two communication networks, and the step of determining whether the real-time bandwidth margin of the communication network to be tested meets the preset bandwidth condition and subsequent steps is returned to execute.
[0039] In some cases, it may happen that the current real-time bandwidth margins of all communication networks do not meet the preset bandwidth condition. Considering that there is a certain delay in obtaining and judging the real-time bandwidth margin, the real-time bandwidth margins of some communication networks may improve after the delay. Based on this, the electronic device will re-trigger the operation of obtaining the real-time bandwidth margins of each communication network, that is, when the current real-time bandwidth margins of all communication networks do not meet the preset bandwidth condition, the electronic device can return to the operation of obtaining the current real-time bandwidth margins of the at least two communication networks in step 101 and subsequent operations to find out again whether there is a target communication network at present.
[0040] As an example only, assume that the current electronic device is equipped with three communication networks A, B, and C, among which communication network A has the highest priority, communication network B has the second highest priority, and communication network C has the lowest priority. After the electronic device obtains the priorities of communication networks A, B, and C, since communication network A has the highest priority, it will first determine whether the current real-time bandwidth margin of communication network A meets the preset bandwidth condition.
[0041] If the current real-time bandwidth margin of communication network A meets the preset bandwidth condition, communication network A can be determined as the target communication network, and communication networks B and C are no longer judged. If the current real-time bandwidth margin of communication network A does not meet the preset bandwidth condition, the electronic device will continue to judge whether the current real-time bandwidth margin of communication network B meets the preset bandwidth condition.
[0042] If the current real-time bandwidth margin of communication network B meets the preset bandwidth condition, communication network B can be determined as the target communication network, and communication network C will no longer be judged. If the current real-time bandwidth margin of communication network B does not meet the preset bandwidth condition, the electronic device will continue to judge whether the current real-time bandwidth margin of communication network C meets the preset bandwidth condition.
[0043] If the current real-time bandwidth margin of communication network C meets the preset bandwidth condition, communication network C can be determined as the target communication network. If the current real-time bandwidth margin of communication network C does not meet the preset bandwidth condition, the electronic device will re-acquire the current real-time bandwidth margins of communication networks A, B and C respectively, and again judge whether the current real-time bandwidth margins of communication networks A, B and C meet the preset bandwidth condition in order from high to low priority. The process can be referred to the previous example and will not be repeated here.
[0044] In some embodiments, for any communication network, whether the current real-time bandwidth margin of the communication network meets the preset bandwidth condition can be determined by the following process: determine whether the current real-time bandwidth margin of the communication network is greater than the preset bandwidth margin threshold, if the real-time bandwidth margin of the communication network is greater than the bandwidth margin threshold, then determine that the real-time bandwidth margin of the communication network meets the preset bandwidth condition. The bandwidth margin threshold can be pre-set by the electronic device, for example, the bandwidth margin threshold can be set to a specific value (such as 5Mbps); or, the bandwidth margin threshold can be set to a percentage of the actual bandwidth of the communication network (such as the actual bandwidth of a communication network is 100Mbps, the bandwidth margin threshold is 5%, then the bandwidth margin threshold of the communication network after conversion is specifically 5Mbps); of course, the bandwidth margin threshold can also be set to other values according to the actual usage scenario, which is not limited here.
[0045] Step 103, setting the target communication network as the egress network of the communication link.
[0046] In the embodiment of the present application, after the target communication network is determined, the communication network can be set as the egress network of the currently newly created communication link. That is, for the data packets belonging to the communication link, they will be subsequently sent and received through the target communication network.
[0047] In some embodiments, see Figure 3 For any communication network equipped by an electronic device, the electronic device can obtain the current real-time bandwidth margin of the communication network in the following ways:
[0048] B1. Detect the working status of the above communication network.
[0049] B2. If the working status of the communication network indicates that the communication network is not working, determining that the current real-time bandwidth margin of the communication network is 0.
[0050] It can be understood that if the working status of the communication network indicates that the communication network is disconnected, or the communication network is manually closed, it can be directly determined that the current real-time bandwidth margin of the communication network is 0.
[0051] B3. If the working status of the communication network indicates that the communication network is working, the current real-time bandwidth margin of the communication network is calculated based on the signal strength, real-time bandwidth and peak bandwidth of the communication network when no packet loss occurs within a preset time period.
[0052] It can be understood that if the working status of the communication network indicates that the communication network is working, that is, it has not been disconnected or manually shut down, then the network parameters of the communication network can be obtained, including signal strength, real-time bandwidth, and peak bandwidth when no packet loss occurs within a preset time period, etc., and the real-time bandwidth margin of the communication network can be calculated based on these network parameters.
[0053] The real-time bandwidth may be approximately equal to the real-time rate in practice, and thus may be obtained by the electronic device by monitoring the real-time rate of the communication network.
[0054] The preset time period can be understood as a concept of a specific time window, for example, the most recent 24 hours, which is not limited here. The electronic device monitors the real-time bandwidth at each moment when no packet loss occurs, and determines the peak value of the real-time bandwidth when no packet loss occurs within the preset time period (that is, within the specific time window, such as the most recent 24 hours) as the peak bandwidth. For ease of understanding, the peak bandwidth can be approximately regarded as the actual maximum bandwidth of the communication network over a long period of time.
[0055] Specifically, see Figure 4 , the calculation process of real-time bandwidth margin is as follows:
[0056] C1. If the signal strength of the communication network is 0, then the real-time bandwidth margin of the communication network is determined to be 0.
[0057] C2. If the signal strength of the communication network is not 0, the calculation weight is determined based on the change trend of the signal strength.
[0058] The electronic device can record the signal strength of the communication network at each moment. When the signal strength of the communication network is not 0, the electronic device can compare the recorded signal strength of the communication network at the previous moment with the signal strength at the current moment. If the comparison finds that the signal strength at the current moment is weaker than the signal strength at the previous moment, then the trend of the signal strength change is determined to be weakening. At this time, there is a possibility of network fluctuation in the communication network, and the corresponding calculation weight can be determined as a value less than 1, for example, it can be 0.9. On the contrary, if the comparison finds that the signal strength at the current moment is the same as or stronger than the signal strength at the previous moment, then the trend of the signal strength change is determined to be stable, and the corresponding calculation weight can be determined to be 1. Of course, the specific values of the calculation weights corresponding to different change trends can also be dynamically set by the electronic device through autonomous learning, which is not limited here.
[0059] C3. Calculate the product of the peak bandwidth and the weight calculated above.
[0060] C4. Determine the difference between the multiplication result and the real-time bandwidth as the real-time bandwidth margin of the communication network.
[0061] For ease of understanding, the peak bandwidth can be recorded as BW max , and the real-time bandwidth is recorded as BW rt , the calculation weight is recorded as w, then the real-time bandwidth margin BW of the communication network al =BW max *w-BW rt .
[0062] In some embodiments, the peak bandwidth may be smaller than the real-time bandwidth, which may cause the calculated real-time bandwidth margin to be unreasonable. In this regard, before step C3, that is, after obtaining the peak bandwidth and the real-time bandwidth, the electronic device may first compare the peak bandwidth with the real-time bandwidth. If it is found that the peak bandwidth is smaller than the real-time bandwidth, the peak bandwidth may be updated to a preset multiple (e.g., 1.2 times, 1.5 times, or 2 times, etc.) of the real-time bandwidth, and the updated peak bandwidth does not exceed the theoretical maximum bandwidth of the communication network. The theoretical maximum bandwidth may be obtained through the network negotiation data of the communication network.
[0063] As an example only, assume that the theoretical maximum bandwidth of the communication network is X, the currently recorded peak bandwidth is Y, the real-time bandwidth is Z, and the preset multiple is 1.2 times. If the electronic device finds through comparison that Y<Z, the peak bandwidth will first be updated to 1.2Y, and the electronic device will compare the updated peak bandwidth 1.2Y with the theoretical maximum bandwidth X. If the electronic device finds through comparison that 1.2Y≤X, the updated peak bandwidth remains at 1.2Y, that is, the peak bandwidth 1.2Y is put into steps C3 and C4 for calculation. If the electronic device finds through comparison that 1.2Y>X, the peak bandwidth will be updated to X again, that is, the peak bandwidth X is put into steps C3 and C4 for calculation.
[0064] Based on the network setting method proposed in the embodiment of the present application, different communication links can work on different communication networks and maintain a certain degree of independence from each other, which can ensure that the fluctuation of a single communication network will not affect the communication links on other communication networks. In addition, when a single communication network fluctuates, the upper-layer specific business will create a new communication link, and the electronic device can select the current optimal communication network as the exit network for the newly created communication link based on the network setting method, thereby achieving hysteresis switching in terms of network switching effect.
[0065] As can be seen from the above, through the embodiments of the present application, the exit network of each newly created communication link is independently set based on the real-time bandwidth margin of each current communication network, which enables each newly created communication link to set the exit network without affecting the original communication link, thereby improving the stability of the network. Moreover, compared with the network setting scheme in the prior art in which all communication links of the device are set to the same exit network in a two-choice or N-choice manner, the present application scheme can maximize the use of the resources of each communication network, which helps to improve the overall bandwidth and network throughput. By setting the priority of the communication network, data packets can be sent from the priority communication network, thereby improving the sending flexibility. For example, a user expects to send data from a wired broadband network first, rather than a wireless mobile network, because the wired broadband network is usually cheaper than the wireless mobile network, thereby saving user costs.
[0066] Corresponding to the network setting method provided above, the embodiment of the present application further provides a network setting device, which is applied to an electronic device having at least two communication networks. Figure 5 As shown, the network setting device 500 includes:
[0067] The acquisition module 501 is used to respectively acquire the real-time bandwidth margins of the at least two communication networks when a new communication link is established;
[0068] A determination module 502 is used to determine a target communication network from the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition;
[0069] The setting module 503 is used to set the target communication network as the egress network of the communication link.
[0070] Optionally, the determination module 502 includes:
[0071] A priority acquisition unit, used to respectively acquire the priorities of the at least two communication networks;
[0072] A network determination unit, configured to determine, in descending order of the priorities, whether the real-time bandwidth margin of the communication network satisfies the preset bandwidth condition, until a communication network whose real-time bandwidth margin satisfies the preset bandwidth condition is obtained, and then stop the determination;
[0073] The network determination unit is used to determine the communication network whose real-time bandwidth margin meets the preset bandwidth condition as the target communication network.
[0074] Optionally, the network determination unit includes:
[0075] A determination subunit, used to determine whether the real-time bandwidth margin of the above communication network is greater than a preset bandwidth margin threshold;
[0076] The determination subunit is configured to determine that the real-time bandwidth margin of the communication network satisfies the preset bandwidth condition if the real-time bandwidth margin of the communication network is greater than the bandwidth margin threshold.
[0077] Optionally, the acquisition module 501 is further configured to respectively acquire the real-time bandwidth margins of the at least two communication networks again when the real-time bandwidth margins of all communication networks do not satisfy the preset bandwidth condition.
[0078] Optionally, the acquisition module 501 includes:
[0079] A status detection unit, used for detecting the working status of each communication network;
[0080] a margin determining unit, configured to determine that the real-time bandwidth margin of the communication network is 0 if the working state of the communication network indicates that the communication network is not working;
[0081] The margin calculation unit is used to calculate the real-time bandwidth margin of the communication network based on the signal strength, real-time bandwidth and peak bandwidth of the communication network when no packet loss occurs within a preset time period if the working status of the communication network indicates that the communication network is working.
[0082] Optionally, the above-mentioned margin calculation unit includes:
[0083] A first determining subunit, configured to determine that the real-time bandwidth margin of the communication network is 0 if the signal strength of the communication network is 0;
[0084] A weight determination subunit, configured to determine a calculation weight based on a change trend of the signal strength if the signal strength of the communication network is not 0;
[0085] A calculation subunit, used to calculate the product of the peak bandwidth and the calculation weight;
[0086] The second determining subunit is used to determine the difference between the multiplication result and the real-time bandwidth as the real-time bandwidth margin of the communication network.
[0087] Optionally, the above-mentioned margin calculation unit further includes:
[0088] A comparison subunit, used for comparing the peak bandwidth with the real-time bandwidth;
[0089] The updating subunit is used for updating the peak bandwidth to a preset multiple of the real-time bandwidth if the peak bandwidth is smaller than the real-time bandwidth, and the updated peak bandwidth does not exceed the theoretical maximum bandwidth of the communication network.
[0090] As can be seen from the above, through the embodiments of the present application, the exit network of each newly created communication link is independently set based on the real-time bandwidth margin of each current communication network, which enables each newly created communication link to set the exit network without affecting the original communication link, thereby improving the stability of the network. Moreover, compared with the network setting scheme in the prior art in which all communication links of the device are set to the same exit network in a two-choice or N-choice manner, the present application scheme can maximize the use of the resources of each communication network, which helps to improve the overall bandwidth and network throughput. By setting the priority of the communication network, data packets can be sent from the priority communication network, thereby improving the sending flexibility. For example, a user expects to send data from a wired broadband network first, rather than a wireless mobile network, because the wired broadband network is usually cheaper than the wireless mobile network, thereby saving user costs.
[0091] Corresponding to the network setting method provided above, the embodiment of the present application further provides an electronic device, which has at least two communication networks. Figure 6 The electronic device 6 in the embodiment of the present application includes: a memory 601, one or more processors 602 ( Figure 6Only one is shown) and a computer program stored in the memory 601 and executable on the processor. The memory 601 is used to store software programs and units, and the processor 602 executes various functional applications and diagnoses by running the software programs and units stored in the memory 601 to obtain the resources corresponding to the above-mentioned preset events. Specifically, the processor 602 implements the following steps when running the above-mentioned computer program stored in the memory 601:
[0092] When a new communication link is established, respectively obtaining the real-time bandwidth margins of the at least two communication networks;
[0093] Determining a target communication network from the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition;
[0094] The target communication network is set as the egress network of the communication link.
[0095] Assuming that the above is a first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, the step of determining a target communication network from among the at least two communication networks includes:
[0096] respectively obtaining the priorities of the at least two communication networks;
[0097] Based on the order of the above priorities from high to low, it is judged in turn whether the real-time bandwidth margin of the communication network meets the above-mentioned preset bandwidth condition, until a communication network whose real-time bandwidth margin meets the above-mentioned preset bandwidth condition is obtained, the judgment is stopped, and the communication network whose real-time bandwidth margin meets the above-mentioned preset bandwidth condition is determined as the above-mentioned target communication network.
[0098] In a third possible implementation manner provided on the basis of the second possible implementation manner, the determining whether the real-time bandwidth margin of the communication network satisfies the preset bandwidth condition includes:
[0099] Determining whether the real-time bandwidth margin of the communication network is greater than a preset bandwidth margin threshold;
[0100] If the real-time bandwidth margin of the communication network is greater than the bandwidth margin threshold, it is determined that the real-time bandwidth margin of the communication network meets the preset bandwidth condition.
[0101] In a fourth possible implementation provided on the basis of the second possible implementation, after determining in sequence whether the real-time bandwidth margin of the communication network meets the preset bandwidth condition, the processor 602 further implements the following steps when running the computer program stored in the memory 601:
[0102] If the real-time bandwidth margins of all the communication networks do not satisfy the preset bandwidth condition, the process returns to the step of respectively obtaining the real-time bandwidth margins of the at least two communication networks and subsequent steps.
[0103] In a fifth possible implementation provided on the basis of the first possible implementation, or the second possible implementation, or the third possible implementation, or the fourth possible implementation, respectively obtaining the real-time bandwidth margins of the at least two communication networks includes:
[0104] For each communication network, detecting the working status of the communication network;
[0105] If the working state of the communication network indicates that the communication network is not working, determining that the real-time bandwidth margin of the communication network is 0;
[0106] If the working status of the communication network indicates that the communication network is working, the real-time bandwidth margin of the communication network is calculated based on the signal strength, the real-time bandwidth and the peak bandwidth when no packet loss occurs within a preset time period of the communication network.
[0107] In a sixth possible implementation provided on the basis of the fifth possible implementation, the real-time bandwidth margin of the communication network is calculated based on the signal strength, the real-time bandwidth and the peak bandwidth when no packet loss occurs within a preset time period of the communication network, including:
[0108] If the signal strength of the communication network is 0, then determining that the real-time bandwidth margin of the communication network is 0;
[0109] If the signal strength of the communication network is not 0, the calculation weight is determined based on the change trend of the signal strength;
[0110] Calculate the product of the peak bandwidth and the calculated weight;
[0111] The difference between the multiplication result and the real-time bandwidth is determined as the real-time bandwidth margin of the communication network.
[0112] In a seventh possible implementation provided on the basis of the sixth possible implementation, before calculating the product result of the peak bandwidth and the calculated weight, the processor 602 further implements the following steps when running the computer program stored in the memory 601:
[0113] Comparing the peak bandwidth with the real-time bandwidth;
[0114] If the peak bandwidth is smaller than the real-time bandwidth, the peak bandwidth is updated to a preset multiple of the real-time bandwidth, and the updated peak bandwidth does not exceed the theoretical maximum bandwidth of the communication network.
[0115] It should be understood that in the embodiment of the present application, the processor 602 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0116] The memory 601 may include a read-only memory and a random access memory, and provide instructions and data to the processor 602. A part or all of the memory 601 may also include a non-volatile random access memory. For example, the memory 601 may also store information of a device category.
[0117] As can be seen from the above, through the embodiments of the present application, the exit network of each newly created communication link is independently set based on the real-time bandwidth margin of each current communication network, which enables each newly created communication link to set the exit network without affecting the original communication link, thereby improving the stability of the network. Moreover, compared with the network setting scheme in the prior art in which all communication links of the device are set to the same exit network in a two-choice or N-choice manner, the present application scheme can maximize the use of the resources of each communication network, which helps to improve the overall bandwidth and network throughput. By setting the priority of the communication network, data packets can be sent from the priority communication network, thereby improving the sending flexibility. For example, a user expects to send data from a wired broadband network first, rather than a wireless mobile network, because the wired broadband network is usually cheaper than the wireless mobile network, thereby saving user costs.
[0118] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0119] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0120] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0121] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the above modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0122] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0123] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the associated hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer-readable memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media does not include electrical carrier signals and telecommunication signals.
[0124] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. 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 make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A network setting method, characterized in that: The network setting method is applied to an electronic device having at least two communication networks, the network types of the at least two communication networks are different, and the electronic device is a smart gateway. The network setting method includes: By judging whether the five-tuple of the TCP or UDP data packet is consistent, it is determined whether a new communication link is currently being established; When a new communication link is established, respectively obtaining the real-time bandwidth margins of the at least two communication networks, wherein the real-time bandwidth margins are determined according to the current working status of the communication network and the current network parameters; Determining a target communication network among the at least two communication networks, wherein a real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition; Setting the target communication network as the egress network of the communication link; Wherein, when the upper-layer specific service of the electronic device receives a communication request sent by a user or other device, the upper-layer specific service creates a new communication link; or, when the egress network where the communication link exists is disconnected, the upper-layer specific service corresponding to the communication link creates a new communication link; The step of respectively obtaining the real-time bandwidth margins of the at least two communication networks includes: For each communication network, detecting the working status of the communication network; If the working state of the communication network indicates that the communication network is not working, determining that the real-time bandwidth margin of the communication network is 0; If the working status of the communication network indicates that the communication network is working, the real-time bandwidth margin of the communication network is calculated based on the signal strength of the communication network, the real-time bandwidth, and the peak bandwidth when no packet loss occurs within a preset time period.
2. The network setting method according to claim 1, characterized in that: The determining of the target communication network among the at least two communication networks comprises: respectively obtaining the priorities of the at least two communication networks; Based on the order of the priorities from high to low, it is judged in turn whether the real-time bandwidth margin of the communication network meets the preset bandwidth condition, until a communication network whose real-time bandwidth margin meets the preset bandwidth condition is obtained, the judgment is stopped, and the communication network whose real-time bandwidth margin meets the preset bandwidth condition is determined as the target communication network.
3. The network setting method according to claim 2, characterized in that: The determining whether the real-time bandwidth margin of the communication network meets the preset bandwidth condition includes: Determining whether the real-time bandwidth margin of the communication network is greater than a preset bandwidth margin threshold; If the real-time bandwidth margin of the communication network is greater than the bandwidth margin threshold, it is determined that the real-time bandwidth margin of the communication network meets the preset bandwidth condition.
4. The network setting method according to claim 2, characterized in that: After successively determining whether the real-time bandwidth margin of the communication network meets the preset bandwidth condition, the network setting method further includes: If the real-time bandwidth margins of all the communication networks do not meet the preset bandwidth condition, the process returns to the step of respectively obtaining the real-time bandwidth margins of the at least two communication networks and subsequent steps.
5. The network setting method according to claim 1, characterized in that: The calculating the real-time bandwidth margin of the communication network based on the signal strength, the real-time bandwidth and the peak bandwidth when no packet loss occurs within a preset time period of the communication network includes: If the signal strength of the communication network is 0, determining that the real-time bandwidth margin of the communication network is 0; If the signal strength of the communication network is not 0, determining the calculation weight based on the change trend of the signal strength; Calculating a product of the peak bandwidth and the calculation weight; The difference between the multiplication result and the real-time bandwidth is determined as the real-time bandwidth margin of the communication network.
6. The network setting method according to claim 5, characterized in that: Before calculating the product result of the peak bandwidth and the calculation weight, the network setting method further includes: comparing the peak bandwidth with the real-time bandwidth; If the peak bandwidth is less than the real-time bandwidth, the peak bandwidth is updated to a preset multiple of the real-time bandwidth, and the updated peak bandwidth does not exceed the theoretical maximum bandwidth of the communication network.
7. A network setting device, characterized in that: The network setting device is applied to an electronic device having at least two communication networks, the network types of the at least two communication networks are different, the electronic device is a smart gateway, and the network setting device includes: an acquisition module, configured to determine whether a new communication link is currently being established by judging whether the five-tuple of the TCP or UDP data packet is consistent, and when the new communication link is established, respectively acquire the real-time bandwidth margin of the at least two communication networks, wherein the real-time bandwidth margin is determined according to the current working state of the communication network and the current network parameters; A determination module, configured to determine a target communication network among the at least two communication networks, wherein the real-time bandwidth margin of the target communication network satisfies a preset bandwidth condition; A setting module, used to set the target communication network as the egress network of the communication link; Wherein, when the upper-layer specific service of the electronic device receives a communication request sent by a user or other device, the upper-layer specific service creates a new communication link; or, when the egress network where the communication link exists is disconnected, the upper-layer specific service corresponding to the communication link creates a new communication link; Wherein, the acquisition module includes: A state detection unit, used for detecting the working state of each communication network; a margin determining unit, configured to determine that the real-time bandwidth margin of the communication network is 0 if the working state of the communication network indicates that the communication network is not working; The margin calculation unit is used to calculate the real-time bandwidth margin of the communication network based on the signal strength, real-time bandwidth and peak bandwidth of the communication network when no packet loss occurs within a preset time period if the working status of the communication network indicates that the communication network is working.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
