Flow distribution method for equipment connected with multiple wireless networks, equipment and medium
By introducing the netd client, netd server and system C library into the device, combining traffic balance strategy and hook function, the handheld device can use multiple wireless networks at the same time when receiving a network access request, solving the problem that devices in the prior art cannot use multiple networks at the same time and improving the user experience.
Patent Information
- Application Number
- CN202510089730.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-16
Smart Images

Figure CN120018208A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to but is not limited to the field of wireless network technology, and in particular to a method, device, and medium for allocating device traffic connected to multiple wireless networks. Background Art
[0002] At present, the Wi-Fi hardware performance of handheld devices such as tablets and mobile phones is mostly excessive. For example, the Wi-Fi of the Android system is only allowed to connect to one AP hotspot by default. In densely populated areas, the wireless network experience is often very poor due to the limitation of a single network outlet or the service capacity of a single AP. Based on this, the existing technology uses the excess network card performance of handheld devices to enable the device to connect to a second WiFi hotspot to obtain more outlet bandwidth and AP resources. However, when the device is connected to multiple WiFi hotspots, it is only physically connected to multiple WiFi hotspots, and does not achieve the purpose of using multiple networks at the same time to improve the Internet experience. Summary of the invention
[0003] The embodiments of the present application provide a method, device, and medium for allocating traffic to a device connected to multiple wireless networks, which can achieve balanced control of the traffic of each network interface corresponding to a device connected to multiple wireless networks, thereby improving user experience.
[0004] In a first aspect, an embodiment of the present application provides a method for distributing device traffic connected to multiple wireless networks, which is applied to a traffic distribution device, wherein the traffic distribution device includes a netd client, a netd server, and a system C library, and the traffic distribution device is connected to multiple wireless network interfaces, and the method includes:
[0005] When receiving a network access request from a target application, a socket connection is established, a connect function in the system C library that has been hooked by the netd client is called, and a hook function of the netd client is called to obtain process attribute information of the target application;
[0006] When the socket type in the process attribute information is IPv4 or IPv6, the netd client sends a traffic balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server;
[0007] The netd server counts the flow status information of each of the wireless network interfaces, wherein the flow status information represents the flow load status of the wireless network interface;
[0008] The netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distributes network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request.
[0009] In some embodiments, the traffic distribution device is an Android device, and the system C library is initialized according to the following steps:
[0010] Call the preset function in the system C library to load the dependency libnetd_client.so associated with the netd client;
[0011] The Hook function associated with the socket operation is registered in the system C library to obtain an initialized system C library.
[0012] In some embodiments, the netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distributes network traffic to the target interface, including:
[0013] Determine all of the wireless network interfaces as the target interfaces;
[0014] Allocate a traffic proportion for each of the target interfaces based on each of the traffic state information and a preset interface traffic proportion, wherein the traffic proportion is a proportion of the reference traffic allocated to each of the target interfaces in the network traffic;
[0015] According to the proportion of each traffic, the network traffic is evenly distributed to each target interface.
[0016] In some embodiments, the target application corresponds to at least one reference interface identifier, and the reference interface identifier is used to uniquely identify the wireless network interface allowed to be used by the target application. The netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information, and each traffic status information, and distributes network traffic to the target interface, including:
[0017] Determine the interface corresponding to the reference interface identifier in the wireless network interface as the target interface;
[0018] The network traffic is distributed to the target interface.
[0019] In some embodiments, the netd server selects a target interface from a plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distributes network traffic to the target interface, including:
[0020] Determine all of the wireless network interfaces as the target interfaces;
[0021] The network traffic is randomly distributed to each of the target interfaces.
[0022] In a second aspect, an embodiment of the present application provides a flow distribution device, the flow distribution device is connected to multiple wireless network interfaces, and the flow distribution device includes: a netd client, a netd server, and a system C library;
[0023] The first processing module is used for, when receiving a network access request of a target application, establishing a socket connection, calling a connect function in the system C library that has been hooked by the netd client, and calling a hook function of the netd client to obtain process attribute information of the target application;
[0024] A second processing module is used for controlling the netd client to send a flow balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server when the socket type in the process attribute information is IPv4 or IPv6;
[0025] A third processing module is used to control the netd server to count the flow status information of each of the wireless network interfaces, wherein the flow status information represents the flow load state of the wireless network interface;
[0026] The fourth processing module is used to control the netd server to select a target interface from multiple wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distribute network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request.
[0027] In some embodiments, the netd server includes:
[0028] A first target interface determination module, configured to determine all of the wireless network interfaces as the target interfaces;
[0029] A flow ratio determination module, used to allocate a flow ratio to each of the target interfaces based on each of the flow status information and a preset interface flow ratio, wherein the flow ratio is a ratio of the reference flow allocated to each of the target interfaces to the network flow;
[0030] The first traffic distribution module is used to evenly distribute the network traffic to each of the target interfaces according to the traffic proportions.
[0031] In some embodiments, the target application corresponds to at least one reference interface identifier, and the reference interface identifier is used to uniquely identify the wireless network interface allowed to be used by the target application. The netd server includes:
[0032] A second target interface determination module, configured to determine an interface in the wireless network interface corresponding to the reference interface identifier as the target interface;
[0033] A second traffic distribution module is used to distribute the network traffic to the target interface. In a third aspect, an embodiment of the present application provides a traffic distribution device, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the device traffic distribution method for connecting multiple wireless networks as described in the first aspect.
[0034] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for allocating device traffic connected to multiple wireless networks as described in the first aspect.
[0035] An embodiment of the present application provides a device traffic distribution method, device, and medium for connecting multiple wireless networks, the method comprising: when a network access request of a target application is received, a socket connection is established, a connect function in the system C library that has been hooked by the netd client is called, and the hook function of the netd client is called to obtain process attribute information of the target application; when the socket type in the process attribute information is IPv4 or IPv6, the netd client sends a traffic balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server; the netd server counts the traffic status information of each of the wireless network interfaces, wherein the traffic status information represents the traffic load status of the wireless network interface; the netd server selects a target interface from the multiple wireless network interfaces based on a preset traffic balancing strategy, the process attribute information, and each of the traffic status information, and distributes network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request. According to the solution provided in the embodiment of the present application, by associating the hook function of the system C library and the netd client, combining the traffic status of each network interface and the preset traffic balancing strategy, the traffic is evenly distributed to each interface, so that a device connected to multiple wireless networks can use multiple networks at the same time to respond to the application network access request when receiving the application network access request of the target application, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is a flowchart of a method for distributing device traffic connected to multiple wireless networks provided by an embodiment of the present application;
[0037] Figure 2 is a module schematic diagram of a flow distribution device provided by another embodiment of the present application;
[0038] Figure 3 It is a structural diagram of a flow distribution device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] It is understood that although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flow chart. The terms "first", "second", etc. in the specification, claims or the above drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0041] At present, the Wi-Fi hardware performance of handheld devices such as tablets and mobile phones is mostly excessive. For example, the Wi-Fi of the Android system is only allowed to connect to one AP hotspot by default. In densely populated areas, the wireless network experience is often very poor due to the limitation of a single network outlet or the service capacity of a single AP. Based on this, the existing technology uses the excess network card performance of handheld devices to enable the device to connect to a second WiFi hotspot to obtain more outlet bandwidth and AP resources. However, when the device is connected to multiple WiFi hotspots, it is only physically connected to multiple WiFi hotspots, and does not achieve the purpose of using multiple networks at the same time to improve the Internet experience.
[0042] To solve the above-mentioned problems, an embodiment of the present application provides a device traffic distribution method, device, and medium for connecting multiple wireless networks, the method comprising: when a network access request of a target application is received, a socket connection is established, the connect function in the system C library that has been hooked by the netd client is called, and the hook function of the netd client is called to obtain the process attribute information of the target application; when the socket type in the process attribute information is IPv4 or IPv6, the netd client sends a traffic balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server; the netd server counts the traffic status information of each of the wireless network interfaces, wherein the traffic status information represents the traffic load status of the wireless network interface; the netd server selects a target interface from the multiple wireless network interfaces based on a preset traffic balancing strategy, the process attribute information, and each of the traffic status information, and distributes network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request. According to the solution provided in the embodiment of the present application, by associating the hook function of the system C library and the netd client, combining the traffic status of each network interface and the preset traffic balancing strategy, the traffic is evenly distributed to each interface, so that a device connected to multiple wireless networks can use multiple networks at the same time to respond to the application network access request when receiving the application network access request of the target application, thereby improving the user experience.
[0043] The embodiments of the present application are further described below in conjunction with the accompanying drawings.
[0044] refer to Figure 1 , Figure 1 The present invention provides a method for distributing device traffic connected to multiple wireless networks, which is applied to a traffic distribution device. The traffic distribution device includes a netd client, a netd server, and a system C library. The traffic distribution device is connected to multiple wireless network interfaces. The method includes but is not limited to the following steps:
[0045] Step S110, when receiving a network access request from the target application, a socket connection is established, the connect function in the system C library that has been hooked by the netd client is called, and the hook function of the netd client is called to obtain the process attribute information of the target application;
[0046] Step S120, when the socket type in the process attribute information is IPv4 or IPv6, the netd client sends a traffic balancing instruction carrying the process attribute information to the FwmarkServxer module of the netd server;
[0047] Step S130, the netd server counts the flow status information of each wireless network interface, wherein the flow status information represents the flow load status of the wireless network interface;
[0048] Step S140, the netd server selects a target interface from multiple wireless network interfaces based on a preset traffic balancing strategy, process attribute information and each traffic status information, and distributes network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request.
[0049] It should be noted that the embodiments of the present application are not limited to specific traffic distribution devices, which can be Android handheld devices such as mobile phones and tablets, or systems with a general Linux kernel, etc.
[0050] It should be noted that the embodiments of the present application do not limit the specific types of wireless network interfaces that are simultaneously connected to the traffic distribution device, which may be a WiFi network, AP hotspot, Ethernet, or 4G / 5G mobile data network, etc.
[0051] It should be noted that the process attribute information of this embodiment is used to indicate the process information of creating a socket connection corresponding to the target application. The process attribute information may include process ID, process name, socket type information, local address and port, etc.
[0052] It can be understood that when the traffic distribution device is an Android device, the netd client of this embodiment is pre-installed with Hook functions that implement Android bionic socket related operations, so that these Hook functions can be used to send the process information of creating the Android bionic socket to the netd server, providing an effective data basis for the netd server to count the traffic status information of each wireless network interface.
[0053] It can be understood that, when the traffic distribution device is connected to multiple wireless network interfaces and each wireless network interface is connected to different network resources, when an application network access request of the target application is received, the system C library associated with the Hook function in the netd client calls the connect function (the connect function is the Hook function associated with the netd client), thereby obtaining the process attribute information corresponding to the target application. The system C library calls the Hook function in the Netd client based on the process attribute information. In this embodiment, the NetdClientConnect function is called; in the process of calling the NetdClientConnect function, the socket type in the process attribute information is detected. When the socket type in the process attribute information is IPv4 or IPv6, the netd client sends a stream carrying the process attribute information to the FwmarkServxer module of the netd server. If the flow balancing instruction is received, the operation will not be performed, so that the wireless network interface only executes the socket connection of the access network such as IPv4 or IPv6, and does not affect the local socket communication process; after the FwmarkServer module of the netd server receives the flow balancing instruction, the netd server selects the target interface from multiple wireless network interfaces based on the preset flow balancing strategy, process attribute information and each flow status information, and distributes the network traffic to the target interface, and executes setsockopt. The specific number of target interfaces in this embodiment depends on the flow balancing strategy, which can be one or more of all wireless network interfaces, and distributes the traffic corresponding to the application network access request to each target interface. When there are multiple target interfaces, it can be realized that when a device connected to multiple wireless networks receives an application network access request of the target application, it can use multiple networks to respond to the application network access request at the same time, thereby improving the user experience.
[0054] In addition, refer to Figure 2 In some embodiments, the traffic distribution device is an Android device. In this case, the initialization process of the system C library includes but is not limited to the following steps:
[0055] Step S210, calling a preset function in the system C library to load a dependency libnetd_client.so associated with the netd client;
[0056] Step S220, registering the Hook function associated with the socket operation in the system C library to obtain the initialized system C library.
[0057] It should be noted that the specific system C library is determined by the type of the traffic distribution device. For example, if the traffic distribution device is an Android device, the system C library is an initialized bionic.
[0058] It can be understood that the initialization process of the system C library of this embodiment includes: calling the preset function in the initial C library to load the dependency libnetd_client.so associated with the netd client, registering the Hook function associated with the socket operation in the initial C library, and obtaining the system C library. After initialization, bionic (i.e., the system C library) of the embodiment of the present application registers a series of Hook functions for socket operations, for example, including accept, connect, sendmmsg, sendmsg, sendto, and socket, etc. These Hook functions are ultimately implemented in the netd client. Due to the existence of these Hook functions, it is possible to modify the socket operation process, providing effective support for realizing network traffic balancing control for devices connected to multiple wireless networks.
[0059] In addition, it should be noted that in some embodiments of the present application, Figure 1 The traffic balancing strategy in step S140 shown is pre-set in the traffic distribution device. This embodiment may include three traffic balancing strategies: distribution according to the traffic status information of the wireless network interface, distribution according to the specific type of the target application that initiates the network access request, or random distribution.
[0060] Specifically, in the case of a traffic balancing strategy allocated according to the traffic state information of the wireless network interface, Figure 1 The step S140 shown includes but is not limited to the following steps:
[0061] Step S141, determining all wireless network interfaces as target interfaces;
[0062] Step S142, allocating a traffic proportion to each target interface based on each traffic state information and a preset interface traffic proportion, wherein the traffic proportion is a proportion of the reference traffic allocated to each target interface in the network traffic;
[0063] Step S143, distribute the network traffic evenly to each target interface according to the proportion of each traffic.
[0064] Specifically, the preset interface traffic ratio of this embodiment is a traffic ratio preset for each wireless network interface, that is, the ratio of interface traffic after subsequent traffic allocation of the network interface needs to meet the preset interface traffic ratio.
[0065] It should be noted that the traffic status information is used to indicate the current traffic status of each wireless network interface (such as Ethernet card, wireless network card, etc.), including the used bandwidth, queue length, delay, packet loss rate, etc. It can understand the network status and load of the current wireless network interface, and provide effective data support for the reasonable allocation of traffic on different wireless network interfaces.
[0066] It can be understood that since each target interface has a preset interface traffic ratio, in the actual traffic distribution process, by determining the traffic status information of each target interface, it is possible to further evenly distribute a reasonable traffic ratio to each target interface based on the current target interface traffic load, traffic bandwidth and other conditions, thereby avoiding the situation where a certain target interface has too much traffic and is congested, while other target interfaces have insufficient traffic, which helps to improve the performance and stability of the entire network system.
[0067] Specifically, in some embodiments, when traffic is distributed according to the specific type of the target application that initiates the network access request, the target application corresponds to at least one reference interface identifier, and the reference interface identifier is used to uniquely identify the wireless network interface that the target application is allowed to use. Figure 1 The step S140 shown includes but is not limited to the following steps:
[0068] Step S144, determining the interface corresponding to the reference interface identifier in the wireless network interface as the target interface;
[0069] Step S145, allocating network traffic to the target interface.
[0070] It can be understood that this embodiment pre-sets that the traffic of a certain application or a certain type of application is only distributed to the designated wireless network interface. The specific steps are: the netd server assigns one or more reference interface identifiers to the target application based on the process attribute information corresponding to different preset applications and the traffic status information of each wireless network interface, that is, assigns the target application a wireless network interface that is allowed to be used. At this time, the interface corresponding to the reference interface identifier in the wireless network interface is determined as the target interface, and all traffic corresponding to the target application, that is, the network traffic, is distributed to all target interfaces.
[0071] Specifically, in some embodiments, when traffic is randomly allocated, Figure 1 The step S140 shown includes but is not limited to the following steps:
[0072] Step S146, determining all wireless network interfaces as target interfaces;
[0073] Step S147, randomly distribute the network traffic to each target interface according to the process attribute information and each traffic status information.
[0074] It can be understood that network traffic is randomly distributed to each target interface based on process attribute information and each traffic status information. When the interface network status and load conditions represented by the traffic status information of each wireless network interface are not much different, the traffic corresponding to the application network access request is randomly distributed to each wireless network interface.
[0075] In summary, this embodiment associates the system C library with the hook function of the netd client, combines the traffic status of each network interface and the preset traffic balancing strategy, and evenly distributes the traffic to each interface, so that when a device connected to multiple wireless networks receives an application network access request of the target application, it uses multiple networks at the same time to respond to the application network access request, thereby improving the user experience. Compared with the prior art that requires a customized API for each wireless network interface and requires multiple modifications during use, the present application solution does not require a customized system interface, so it is imperceptible to users and APP developers, thereby achieving the effect that the traffic distribution strategy can take effect under any application request.
[0076] In addition, refer to Figure 2 The embodiment of the present application further provides a flow distribution device 200, the flow distribution device 200 is connected to multiple wireless network interfaces, and the flow distribution device includes:
[0077] netd client 210, netd server 220 and system C library 230;
[0078] The first processing module 240 is used to establish a socket connection when receiving a network access request from a target application, call the connect function in the system C library 230 that has been hooked by the netd client 210, and call the hook function of the netd client 210 to obtain process attribute information of the target application;
[0079] The second processing module 250 is used to control the netd client 210 to send a traffic balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server 220 when the socket type in the process attribute information is IPv4 or IPv6;
[0080] The third processing module 260 is used to control the netd server 220 to collect statistics on the flow status information of each wireless network interface, wherein the flow status information represents the flow load status of the wireless network interface;
[0081] The fourth processing module 270 is used to control the netd server 220 to select a target interface from multiple wireless network interfaces based on a preset traffic balancing strategy, process attribute information and various traffic status information, and distribute network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request.
[0082] In some embodiments, the netd server 220 includes:
[0083] A first target interface determination module 221, configured to determine all wireless network interfaces as target interfaces;
[0084] A flow ratio determination module 222 is used to allocate a flow ratio to each target interface based on each flow state information, wherein the flow ratio is the ratio of the reference flow allocated to each target interface to the network flow;
[0085] The first traffic distribution module 223 is used to evenly distribute the network traffic to each target interface according to the proportion of each traffic.
[0086] In some embodiments, the target application corresponds to at least one reference interface identifier, and the reference interface identifier is used to uniquely identify the wireless network interface that the target application is allowed to use. The netd server includes:
[0087] A second target interface determination module 224, configured to determine an interface in the wireless network interface corresponding to the reference interface identifier as a target interface;
[0088] The second traffic distribution module 225 is used to distribute the network traffic to the target interface.
[0089] It should be noted that the specific implementation of the traffic distribution device is basically the same as the specific implementation example of the above-mentioned device traffic distribution method for connecting multiple wireless networks, and will not be repeated here.
[0090] like Figure 3 As shown, Figure 3 : is a structural diagram of a flow distribution device provided by an embodiment of the present application. The present invention also provides a flow distribution device 300, including:
[0091] The processor 310 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0092] The memory 320 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 320 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 320, and the processor 310 calls and executes the device traffic distribution method for connecting multiple wireless networks in the embodiment of this application;
[0093] Input / output interface 330, used to implement information input and output;
[0094] Communication interface 340, used to realize communication interaction between the apparatus and other devices, which can be realized by wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);
[0095] bus 350 , which transmits information between the various components of the device (e.g., processor 310 , memory 320 , input / output interface 330 , and communication interface 340 );
[0096] The processor 310 , the memory 320 , the input / output interface 330 and the communication interface 340 are connected to each other in communication within the device via the bus 350 .
[0097] In addition, an embodiment of the present application further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the above-mentioned device traffic distribution method for connecting multiple wireless networks is implemented.
[0098] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0099] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0100] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A method for distributing device traffic connected to multiple wireless networks, characterized in that: Applied to a traffic distribution device, the traffic distribution device includes a netd client, a netd server and a system C library, the traffic distribution device is connected to multiple wireless network interfaces, and the method includes: When receiving a network access request from a target application, a socket connection is established, a connect function in the system C library that has been hooked by the netd client is called, and a hook function of the netd client is called to obtain process attribute information of the target application; When the socket type in the process attribute information is IPv4 or IPv6, the netd client sends a traffic balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server; The netd server counts the flow status information of each of the wireless network interfaces, wherein the flow status information represents the flow load status of the wireless network interface; The netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distributes network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request.
2. The method for distributing device traffic for connecting multiple wireless networks according to claim 1, characterized in that: The traffic distribution device is an Android device, and the system C library is initialized according to the following steps: Call the preset function in the system C library to load the dependency libnetd_client.so associated with the netd client; The Hook function associated with the socket operation is registered in the system C library to obtain an initialized system C library.
3. The method for distributing device traffic for connecting multiple wireless networks according to claim 1, characterized in that: The netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distributes network traffic to the target interface, including: Determine all of the wireless network interfaces as the target interfaces; Allocate a traffic proportion for each of the target interfaces based on each of the traffic state information and a preset interface traffic proportion, wherein the traffic proportion is a proportion of the reference traffic allocated to each of the target interfaces in the network traffic; According to the proportion of each traffic, the network traffic is evenly distributed to each target interface.
4. The method for distributing device traffic connected to multiple wireless networks according to claim 1, characterized in that: The target application corresponds to at least one reference interface identifier, and the reference interface identifier is used to uniquely identify the wireless network interface allowed to be used by the target application. The netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information, and each traffic status information, and distributes network traffic to the target interface, including: Determine the interface corresponding to the reference interface identifier in the wireless network interface as the target interface; The network traffic is distributed to the target interface.
5. The method for distributing device traffic connected to multiple wireless networks according to claim 1, characterized in that: The netd server selects a target interface from the plurality of wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distributes network traffic to the target interface, including: Determine all of the wireless network interfaces as the target interfaces; The network traffic is randomly distributed to each of the target interfaces.
6. A flow distribution device, characterized in that: The traffic distribution device is connected to a plurality of wireless network interfaces, and the traffic distribution device comprises: a netd client, a netd server and a system C library; The first processing module is used for, when receiving a network access request of a target application, establishing a socket connection, calling a connect function in the system C library that has been hooked by the netd client, and calling a hook function of the netd client to obtain process attribute information of the target application; A second processing module is used for controlling the netd client to send a flow balancing instruction carrying the process attribute information to the FwmarkServer module of the netd server when the socket type in the process attribute information is IPv4 or IPv6; A third processing module is used to control the netd server to count the flow status information of each of the wireless network interfaces, wherein the flow status information represents the flow load state of the wireless network interface; The fourth processing module is used to control the netd server to select a target interface from multiple wireless network interfaces based on a preset traffic balancing strategy, the process attribute information and each of the traffic status information, and distribute network traffic to the target interface, wherein the network traffic is the traffic corresponding to the network access request.
7. The flow distribution device according to claim 6, characterized in that: The netd server includes: A first target interface determination module, configured to determine all of the wireless network interfaces as the target interfaces; A flow ratio determination module, used for allocating flow ratios to each of the target interfaces based on each of the flow status information, wherein the flow ratios are ratios of reference flows allocated to each of the target interfaces to the network flow; The first traffic distribution module is used to evenly distribute the network traffic to each of the target interfaces according to the traffic proportions.
8. The flow distribution device according to claim 6, characterized in that: The target application corresponds to at least one reference interface identifier, and the reference interface identifier is used to uniquely identify the wireless network interface that the target application is allowed to use. The netd server includes: A second target interface determination module, configured to determine an interface in the wireless network interface corresponding to the reference interface identifier as the target interface; The second traffic distribution module is used to distribute the network traffic to the target interface.
9. A flow distribution device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the device traffic distribution method for connecting multiple wireless networks as described in any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the device traffic distribution method for connecting multiple wireless networks as described in any one of claims 1 to 5.