CN114666864A - Multi-network communication method, terminal device, storage medium, and program product - Google Patents

Multi-network communication method, terminal device, storage medium, and program product Download PDF

Info

Publication number
CN114666864A
CN114666864A CN202210302706.8A CN202210302706A CN114666864A CN 114666864 A CN114666864 A CN 114666864A CN 202210302706 A CN202210302706 A CN 202210302706A CN 114666864 A CN114666864 A CN 114666864A
Authority
CN
China
Prior art keywords
network
interface
default
default network
terminal device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210302706.8A
Other languages
Chinese (zh)
Inventor
董亮亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Priority to CN202210302706.8A priority Critical patent/CN114666864A/en
Publication of CN114666864A publication Critical patent/CN114666864A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W40/00Communication routing or communication path finding
    • H04W40/02Communication route or path selection, e.g. power-based or shortest path routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/24Multipath

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application relates to the technical field of network communication, and provides a multi-network communication method, terminal equipment, a storage medium and a program product, which are used for solving the problem that the related technology cannot meet the requirement of simultaneous communication of multiple networks. The method comprises the steps of accessing an access device of a first network, establishing a first interface for the first network, allocating a first IP address for the first interface, generating a first non-gateway route of the first network based on the first interface and the first IP address of the first network if a second network is a default network, adding the first non-gateway route and the first interface into the second network, and keeping the second network as the default network. According to the embodiment of the application, the first non-gateway route is added into the default network, and the default network is continuously used, so that the plurality of access devices can simultaneously communicate through the non-gateway route included in the default network, the simultaneous communication between the terminal device and the plurality of access devices is realized, the communication efficiency is improved, and the problem of complex network conversion operation is avoided.

Description

Multi-network communication method, terminal device, storage medium, and program product
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a multi-network communication method, a terminal device, a storage medium, and a program product.
Background
Currently, android systems support multiple types of networks, such as Wi-Fi, mobile data, bluetooth, ethernet, etc. However, the android system only allows one network to be online by default, for example, after a Wi-Fi network is connected, a data network is turned off, and the multi-network communication requirement cannot be met.
It can be seen that the related art cannot meet the requirement of multi-network communication, and it is necessary to provide a multi-network communication method to facilitate a user to use multiple networks simultaneously.
Disclosure of Invention
An object of the present application is to provide a multi-network communication method, a terminal device, a storage medium, and a program product, so as to solve the problem that the related art cannot meet the requirement of simultaneous communication of multiple networks.
In a first aspect, the present application provides a multi-network communication method, including:
an access device accessing a first network;
establishing a first interface for the first network, and allocating a first IP address for the first interface;
and if the second network is the default network, generating a first non-gateway route of the first network based on the first interface and the first IP address of the first network, adding the first non-gateway route and the first interface into the second network, and keeping the second network as the default network.
In some embodiments, the method further comprises:
generating a network number of the first network;
if the default network is detected to be disconnected, selecting a new default network based on network priority;
adding a designated non-gateway route in the default network to the new default network based on the network number of the new default network, the designated non-gateway route being the remaining non-gateway routes in the default network except the non-gateway route of the default network.
In some embodiments, the method further comprises:
and if the gateway route is stored in the default network, deleting the gateway route in the default network.
In some embodiments, the method further comprises:
and if the disconnection of the non-default network is detected, deleting the non-gateway route of the non-default network from the default network.
In some embodiments, the method further comprises:
if target data are sent to access equipment of a plurality of target networks, searching an interface of each target network in the default network;
and distributing the target data to corresponding access equipment through the interface of the access equipment of each target network.
In some embodiments, the method further comprises:
receiving data to be processed sent by any access equipment, wherein the data to be processed comprises an IP address of a target network;
searching an interface identifier corresponding to the IP address of the target network in the default network;
and sending the data to be processed to an interface corresponding to the interface identifier for processing.
In some embodiments, the method further comprises:
and if all the non-default networks are detected to be disconnected, adding the gateway route of the default network into the default network.
In a second aspect, the present application further provides a multi-network communication apparatus, the apparatus comprising:
an access module configured to access an access device of a first network;
the establishing module is configured to establish a first interface for the first network and allocate a first IP address for the first interface;
an adjustment module configured to generate a first non-gateway route of a first network based on the first interface and the first IP address of the first network, add the first non-gateway route and the first interface to a second network, and keep the second network as a default network, if the second network exists as the default network.
In some embodiments, the apparatus further comprises:
a default network switching module configured to:
generating a network number of the first network;
if the default network is detected to be disconnected, selecting a new default network based on network priority;
adding a designated non-gateway route in the default network to the new default network based on the network number of the new default network, the designated non-gateway route being the remaining non-gateway routes in the default network except the non-gateway route of the default network.
In some embodiments, the adjustment module is further configured to delete a gateway route in the default network if the gateway route is stored in the default network.
In some embodiments, the adjustment module is further configured to delete non-gateway routes of the non-default network from the default network if a non-default network disconnection is detected.
In some embodiments, the apparatus further comprises:
the first sending module is configured to search an interface of each target network in the default network if target data are sent to access equipment of a plurality of target networks;
a distribution module configured to distribute the target data to corresponding access devices through interfaces of the access devices of the target networks, respectively.
Optionally, the apparatus further comprises:
the device comprises a receiving module, a processing module and a processing module, wherein the receiving module is configured to receive data to be processed sent by any equipment, and the data to be processed comprises an IP address of a target network;
the searching module is configured to search the default network for an interface identifier corresponding to the IP address of the target network;
and the second sending module is configured to send the data to be processed to the interface corresponding to the interface identifier for processing.
Optionally, the adjusting module is further configured to add the gateway route of the default network to the default network if it is detected that all non-default networks are disconnected.
In a third aspect, the present application further provides a terminal device, including:
a display, a processor, and a memory;
the display is used for displaying information;
the memory to store the processor-executable instructions;
the processor is configured to execute the instructions to implement any of the methods as provided in the first aspect of the application.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where instructions, when executed by a processor of a terminal device, enable the terminal device to perform any one of the methods as provided in the first aspect of the present application.
In a fifth aspect, an embodiment of the present application provides a computer program product comprising a computer program that, when executed by a processor, implements any of the methods as provided in the first aspect of the present application.
The technical scheme provided by the embodiment of the application at least has the following beneficial effects:
in summary, in the embodiment of the present application, the first non-gateway route is added to the default network, and the default network is continuously used, so that the multiple access devices can simultaneously communicate through the non-gateway route included in the default network, thereby realizing simultaneous communication between the terminal device and the multiple access devices, improving communication efficiency, avoiding the problem of complex network conversion operation, and improving user experience.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application. On the basis of the common knowledge in the field, the above preferred conditions can be combined randomly to obtain the preferred embodiments of the application.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 2 is a schematic diagram of a software architecture of a terminal device according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of accessing a first access device in the related art according to an embodiment of the present application;
fig. 4 is a schematic flowchart of accessing a second access device in the related art according to an embodiment of the present application;
fig. 5 is a flowchart illustrating a multi-network communication method according to an embodiment of the present application;
fig. 6 is a schematic diagram of a system after accessing a first access device according to an embodiment of the present application;
fig. 7 is a schematic flowchart of accessing a second access device according to an embodiment of the present application;
fig. 8 is a schematic diagram of a system after accessing a second access device according to an embodiment of the present application;
fig. 9 is a schematic diagram of a system after disconnecting a first access device according to an embodiment of the present application;
fig. 10 is a flowchart illustrating an example of accessing a third access device according to the present application;
fig. 11 is a schematic diagram of a system after accessing a third access device according to an embodiment of the present application;
fig. 12 is a schematic application scenario diagram of a multi-network communication method according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of a multi-network communication device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. The embodiments described are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Also, in the description of the embodiments of the present application, "/" indicates an inclusive meaning unless otherwise specified, for example, a/B may indicate a or B; "and/or" in the text is only an association relationship describing an associated object, and means that three relationships may exist, for example, a and/or B may mean: three cases of a alone, a and B both, and B alone exist, and in addition, "a plurality" means two or more than two in the description of the embodiments of the present application.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the features, and in the description of embodiments of the application, unless stated otherwise, "plurality" means two or more.
A multi-network communication method provided by the present application will be described below with reference to embodiments.
The inventive concept of the present application can be summarized as follows: firstly, accessing equipment of a first network, establishing a first interface for the first network, allocating a first IP address for the first interface, if a second network is a default network, generating a first non-gateway route of the first network based on the first interface and the first IP address of the first network, adding the first non-gateway route and the first interface into the second network, and keeping the second network as the default network. In summary, in the embodiment of the present application, the first non-gateway route is added to the default network, and the default network is continuously used, so that the multiple access devices can simultaneously communicate through the non-gateway route included in the default network, thereby realizing simultaneous communication between the terminal device and the multiple access devices, improving communication efficiency, avoiding the problem of complex network conversion operation, and improving user experience.
After the main inventive concepts of the embodiments of the present application are introduced, some simple descriptions are provided below for application scenarios to which the technical solutions of the embodiments of the present application can be applied, and it should be noted that the application scenarios described below are only used for describing the embodiments of the present application and are not limited. In specific implementation, the technical scheme provided by the embodiment of the application can be flexibly applied according to actual needs.
First, fig. 1 shows a schematic configuration diagram of a terminal device 100.
The following specifically describes the embodiment by taking the terminal device 100 as an example. It should be understood that the terminal device 100 shown in fig. 1 is only an example, and the terminal device 100 may have more or less components than those shown in fig. 1, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
A block diagram of a hardware configuration of a terminal device 100 according to an exemplary embodiment is exemplarily shown in fig. 1. As shown in fig. 1, the terminal device 100 includes: a Radio Frequency (RF) circuit 110, a memory 120, a display unit 130, a camera 140, a sensor 150, an audio circuit 160, a Wireless Fidelity (Wi-Fi) module 170, a processor 180, a bluetooth module 181, and a power supply 190.
The RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and may receive downlink data of a base station and then send the downlink data to the processor 180 for processing; the uplink data may be transmitted to the base station. Typically, the RF circuitry includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like.
The memory 120 may be used to store software programs and data. The processor 180 performs various functions of the terminal device 100 and data processing by executing software programs or data stored in the memory 120. The memory 120 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. The memory 120 stores an operating system that enables the terminal device 100 to operate. The memory 120 may store an operating system and various application programs, and may also store program codes for performing the methods described in the embodiments of the present application.
The display unit 130 may be used to receive input numeric or character information and generate signal input related to user settings and function control of the terminal device 100, and specifically, the display unit 130 may include a touch screen 131 disposed on the front surface of the terminal device 100 and may collect touch operations of a user thereon or nearby, for example, viewing network data and the like.
The display unit 130 may also be used to display a Graphical User Interface (GUI) of information input by or provided to the user and various menus of the terminal apparatus 100. Specifically, the display unit 130 may include a display screen 132 disposed on the front surface of the terminal device 100. The display screen 132 may be configured in the form of a liquid crystal display, a light emitting diode, or the like. The display unit 130 may be used to display the program reading and writing process in the present application.
The touch screen 131 may cover the display screen 132, or the touch screen 131 and the display screen 132 may be integrated to implement the input and output functions of the terminal device 100, and after the integration, the touch screen may be referred to as a touch display screen for short. In the present application, the display unit 130 may display the application programs and the corresponding operation steps.
The camera 140 may be used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing elements convert the optical signals into electrical signals which are then passed to the processor 180 for conversion into digital image signals.
The terminal device 100 may further comprise at least one sensor 150, such as an acceleration sensor 151, a distance sensor 152, a fingerprint sensor 153, a temperature sensor 154. The terminal device 100 may also be configured with other sensors such as a gyroscope, barometer, hygrometer, thermometer, infrared sensor, light sensor, motion sensor, and the like.
The audio circuitry 160, speaker 161, microphone 162 may provide an audio interface between a user and the terminal device 100. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161. The terminal device 100 may be further provided with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, converts the electrical signal into audio data after being received by the audio circuit 160, and outputs the audio data to the RF circuit 110 to be transmitted to, for example, another terminal device, or outputs the audio data to the memory 120 for further processing. In this application, the microphone 162 may capture the voice of the user.
Wi-Fi belongs to a short-distance wireless transmission technology, and the terminal device 100 can help a user to send and receive e-mails, browse webpages, access streaming media and the like through the Wi-Fi module 170, and provides wireless broadband internet access for the user.
The processor 180 is a control center of the terminal device 100, connects various parts of the entire terminal device using various interfaces and lines, and performs various functions of the terminal device 100 and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, processor 180 may include one or more processing units; the processor 180 may also integrate an application processor, which mainly handles operating systems, user interfaces, applications, etc., and a baseband processor, which mainly handles wireless communications. It will be appreciated that the baseband processor described above may not be integrated into the processor 180. In the present application, the processor 180 may run an operating system, an application program, a user interface display, and a touch response, and the multi-network communication method according to the embodiments of the present application. Further, the processor 180 is coupled with the display unit 130.
And the bluetooth module 181 is configured to perform information interaction with other bluetooth devices having a bluetooth module through a bluetooth protocol. For example, the terminal device 100 may establish a bluetooth connection with a wearable terminal device (e.g., a smart watch) also equipped with a bluetooth module through the bluetooth module 181, so as to perform data interaction.
The terminal device 100 also includes a power supply 190 (such as a battery) for powering the various components. The power supply may be logically connected to the processor 180 through a power management system to manage charging, discharging, power consumption, etc. through the power management system. The terminal device 100 may further be configured with a power button for powering on and off the terminal device, and locking the screen.
Fig. 2 is a block diagram of a software configuration of the terminal device 100 according to the embodiment of the present application.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system may be divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer, from top to bottom, respectively.
The application layer may include a series of application packages.
As shown in fig. 2, the application package may include camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc. applications.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in fig. 2, the application framework layer can be divided into a java side and a native side, wherein the java side includes a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, an application manager, and the like. The installation management service (PMS) is located in an application manager (not shown) of the application framework layer in fig. 2.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, dialed and answered calls, browsing history and bookmarks, phone books, short messages, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including an authorization prompt box may include a view displaying text and a view displaying pictures.
The phone manager is used to provide the communication function of the terminal device 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources, such as localized strings, icons, pictures, layout files, video files, etc., to the application.
The notification manager allows the application to display notification information (e.g., message digest of short message, message content) in the floating window, can be used to convey notification-type messages, and can automatically disappear after a short dwell without user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scrollbar text in a status bar at the top of the system, such as a notification of a running application in the background, or a notification that appears on the screen in the form of a dialog window. For example, text information is prompted in the status bar, a prompt tone is given, the terminal device vibrates, an indicator light flickers, and the like.
The service of the native side is positioned at the native side of the application program framework layer and is adjacent to the system library, and the installd is the service belonging to the native side.
The Android Runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), Media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
A 2D (an animation mode) graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
The terminal device 100 in the embodiment of the present application may be a mobile phone, a tablet computer, a wearable device, a television, and other terminal devices that can be equipped with an android system.
In the related technology, the android system supports multiple networks such as mobile data, Wi-Fi, Bluetooth and Ethernet, the networks are prioritized, and after a high-priority network is connected, the system disconnects a low-priority network. At the same time, only one network is allowed to be online, and the online network is called the default network. For example, after the mobile data network is connected, the Wi-Fi network is connected, and the system disconnects the data network because the Wi-Fi network has high priority; if the network of the same level is connected with the network of the later connection in the time sequence, the network of the later connection is set as the default network, and the network of the earlier connection is disconnected, so that one network is always kept online.
Each network corresponds to an access device, for example, a router is used to access a Wi-Fi network, the access device of the Wi-Fi network is the router, for example, the access device corresponding to the data network is a base station, the access device of the bluetooth network is an opposite-end bluetooth device connected, and when an ethernet connection camera is used, the camera is an access device corresponding to the ethernet. After the access device accesses the terminal device, a system of the terminal device establishes a corresponding interface to facilitate communication with the corresponding access device. If the terminal device sends a data packet to a certain access device, the system of the terminal device will first obtain the interface of the access device and realize the communication between the terminal device and the access device through the network connecting the access device and the terminal device. Different types of access devices have different types of networks, and the different types of networks correspond to different types of interfaces, for example, interfaces corresponding to Wi-Fi networks are wlan0 and wlan1, and interfaces corresponding to ethernet networks are eth0 and eth 1.
Taking an example that a network connecting the access device and the terminal device is an ethernet network, when the first access device accesses the terminal device, a flow in the related art is shown in fig. 3, which includes the following contents:
after the first access device accesses, in step 301, the kernel layer establishes a network interface eth 0.
In step 302, an IP address is assigned to interface eth 0.
In step 303, the frame layer detects a new network join. After the kernel layer establishes the interface eth0, an event is reported to the frame layer (located in the application framework layer of fig. 2), and an event listener exists in the frame layer, and after the event listener hears the event uploaded by the kernel layer, the event listener indicates that the frame layer detects the network join.
In step 304, a network number is assigned to the network, such as to network 100.
In step 305, interface eth0 is added to network 100.
In step 306, the route associated with interface eth0 is added to network 100.
Finally, in step 307, the frame layer sets the network 100 as a default network.
It should be noted that the event uploaded by the kernel layer indicates the name of the interface, and the frame layer determines what kind of network is based on the character composition of the name of the interface, for example, eth starts with ethernet and wlan starts with Wi-Fi.
The routing is divided into two types, including non-gateway routing and gateway routing. The non-gateway route sends out the data packet sent to a specified IP network segment from a specified network port (interface); the gateway route is called as a default route, and is used for sending out a data packet from a certain specified network port under the condition that all non-gateway routes in a routing table cannot be matched. Whether the routing is gateway routing or non-gateway routing, the corresponding relation between the IP address and the interface identifier is stored in the routing table, and the interface identifier is used for calling a corresponding interface. For example, the IP address of the interface eth0 is 192.168.1.3, the subnet mask is 255.255.255.0, all packets accessing the 192.168.1 network segment are defined to be sent from eth0 corresponding to the non-gateway route, the gateway route will define all packets accessing the rest network segment to be sent from eth0, and eth0 is an interface identifier for invoking the corresponding interface eth 0. It can be seen that for the case of only one network, both the non-gateway route and the gateway route are assigned to the same portal. After accessing the first access device, if the second access device is accessed, the specific process is shown in fig. 4, and includes the following steps:
after the second access device accesses, in step 401, the kernel layer establishes a network interface eth 1.
In step 402, an IP address is assigned to interface eth 1.
In step 403, the frame layer detects a new network join. After the kernel layer establishes the interface eth0, an event is reported to the frame layer, and the frame layer has an event listener, and the event listener monitors the event uploaded by the kernel layer, that is, the event listener indicates that the frame layer detects network joining.
In step 404, a network number is assigned to the network, such as to network 101.
In step 405, interface eth1 is added to network 101.
In step 406, the route associated with interface eth1 is added to network 101.
Finally, in step 407, the frame layer sets network 101 as the default network and disconnects network 100.
If the terminal device supports more device accesses, the procedure is the same as that in fig. 4 described above when accessing a third, a fourth, and so on more access devices. However, the above system only allows one network to be online by default, and even if a terminal device can access multiple devices, the system cannot realize simultaneous communication of the multiple devices through the corresponding multiple networks.
As shown in fig. 5, the multi-network communication method provided in the embodiment of the present application includes the following steps:
the kernel layer accesses an access device of the first network in step 501.
The embodiment of the present application supports multiple networks such as mobile data, Wi-Fi, bluetooth, and ethernet, and the access device of the first network may be a device such as a bluetooth headset and a camera, which is not limited in the embodiment of the present application.
The kernel layer establishes a first interface for the first network and assigns a first IP address for the first interface in step 502.
In step 503, if the second network is the default network, the framework layer generates a first non-gateway route of the first network based on the first interface and the first IP address of the first network, joins the first non-gateway route and the first interface to the second network, and keeps the second network as the default network.
Compared with the prior art, after the multi-network communication method is adopted in the embodiment of the application, the first interface access flow is consistent with the flow in the prior art, and native logic is adopted, so that no change is needed. The method is different from the prior art if after accessing a first access device, the terminal device accesses another access device again.
For example, when a terminal device accesses a first access device, a network and a route condition existing in an android system at this time are as shown in fig. 6, the android system includes a network 100, which is a default network, the network 100 includes a non-gateway route of an interface eth0, an interface eth0, and a gateway route of an interface eth0, the network 100 is a network connecting the terminal device and the access device, the interface eth0 is an interface connecting the terminal device and the access device, and is also an interface of the network 100, and the non-gateway route of the interface eth0 and the gateway route of the interface eth0 are the non-gateway route and the gateway route generated based on the interface eth0 and the IP address of the network 100.
If the terminal device accesses the second access device, the flowchart is shown in fig. 7, and includes the following contents:
in step 701, the kernel layer establishes a network interface eth 1. Corresponding to step 502, a first interface is established for the first network, and the network interface eth1 is the first interface.
In step 702, an IP address is assigned to interface eth 1. A first IP address is assigned to the first interface corresponding to step 502.
In step 703, the frame layer detects a new network join. After the kernel layer establishes the interface eth1, an event is reported to the frame layer, and the frame layer has an event listener, and the event listener monitors the event uploaded by the kernel layer, that is, the event listener indicates that the frame layer detects new network joining.
In step 704, a network number is assigned to the network, such as to network 101.
If the system detects that a default network 100 already exists, which default network 100 corresponds to the second network in step 503, then in step 705, interface eth1 is added to the network 100.
In step 706, the non-gateway route of interface eth1 is added to the network 100.
Finally, in step 707, the frame layer does not set network 101 as the default network, and keeps network 100 as the default network.
It should be noted that, if the terminal device accesses multiple access devices, all gateway routes in multiple interfaces corresponding to the multiple access devices are deleted in the embodiment of the present application. During testing, when discovering that the terminal device accesses a plurality of access devices, the presence of gateway routing can cause routing confusion, which easily causes that an interface of a certain access device cannot be accessed. Therefore, in order to enable each interface to be used normally, all gateway routes are deleted, and only non-gateway routes are reserved to realize the communication capability of the local area network in the embodiment of the application.
As shown in fig. 8, after the second access device accesses, the network and routing conditions in the terminal device system include: the default network 100 includes an interface eth0 and an interface eth1, which correspond to the first access device and the second access device, respectively, and a non-gateway route of the interface eth0 and a non-gateway route of the interface eth1, and there is no interface and route in the network 101, but the network cannot be deleted because this is a network established by the framework layer corresponding to the interface eth1, and although the network 101 does not provide a routing service, some information of the interface eth1 is stored, and this information can be used in a process of setting the network 101 as a default network after the default network 100 is disconnected.
For example, if the default network 100 is disconnected, that is, the first access device is disconnected, the network 101 is set as the default network, the non-gateway routing interface eth1 of the interface eth1 is added to the network 101, and the network 100 is also deleted, where the network and routing conditions in the terminal device system are as shown in fig. 9, and include: default network 101 interface eth1, corresponding to the second access device, and interface eth1 non-gateway routing.
It should be added that if there are more devices accessing the terminal device, the flow is similar to the flow in fig. 7, and only the interface, the IP address, the network number, and the non-gateway route of the interface of the device are adjusted accordingly. Taking the third access device as an example, the flow is shown in fig. 10, and includes the following contents:
in step 1001, the kernel layer establishes a network interface eth 2. Corresponding to step 502, a first interface is established for the first network, and the network interface eth2 is the first interface.
In step 1002, an IP address is assigned to interface eth 2. A first IP address is assigned to the first interface corresponding to step 502.
In step 1003, the frame layer detects a new network join. After the kernel layer establishes the interface eth2, an event is reported to the frame layer, and the frame layer has an event monitor which monitors the event uploaded by the kernel layer, that is, the event monitor indicates that the frame layer detects a new network join.
In step 1004, the network is assigned a network number, such as network 102.
If the system detects that a default network 100 already exists, which default network 100 corresponds to the second network in step 503, then in step 1005, interface eth2 is added to the network 100.
In step 1006, the non-gateway route of interface eth2 is added to network 100.
Finally, in step 1007, the frame layer does not set network 102 as the default network, and keeps network 100 as the default network.
As shown in fig. 11, the network and routing conditions in the system of the terminal device after the third access device accesses the terminal device include: the default network 100 includes an interface eth0, an interface eth1, and an interface eth2, which correspond to the first access device, the second access device, and the third access device, and a non-gateway route of the interface eth0, a non-gateway route of the interface eth1, and a non-gateway route of the interface eth2, and there is no interface or route in the network 101 and the network 102. In the above default network 100, the three access devices can communicate simultaneously through the corresponding interfaces, and by deleting the gateway route, the situation that a certain interface cannot be accessed due to route confusion caused by the gateway route is avoided, and the communication efficiency is improved.
In some embodiments, if a default network disconnection is detected, selecting a new default network based on network priority; and adding the designated non-gateway route in the default network into the new default network based on the network number of the new default network, wherein the designated non-gateway route is the rest non-gateway route in the default network except the non-gateway route of the default network.
For example, as shown in fig. 8, there are 2 networks in the terminal device: network 100 and network 101. If the default network 100 is disconnected, the framework layer detects that the network 100 is lost, the network 101 with the highest priority is selected according to the network priority to be set as the default network, the interface eth1 is removed from the network 100 and then added into the network 101, and the non-gateway route of the interface eth1 is removed from the network 100 and then added into the network 101.
It should be noted that, if it is detected that the default network is disconnected and there are more than 2 networks in the terminal device, a new default network is selected according to the network priority. For example, priorities are fixed for various networks in the android system, Ethernet > Wi-Fi > mobile data, and a network with the highest priority is selected as a default network according to the priority when the default network is selected; if there are multiple networks with the same priority, then the first network found is taken as the default network, for example, there are multiple networks in the current system, including wlan0, eth0, eth1, eth2, etc., the system will look at each network in turn, if the priorities of eth0, eth1, eth2 are the highest and equal, because eth0 is the first network looked at, then eth0 is selected as the default network.
In other embodiments, if a disconnection of the non-default network is detected, non-gateway routes of the non-default network are deleted from the default network. For example, network 102 is a non-default network, and if a disconnection of network 102 is detected, non-gateway routes of network 102 are removed from network 100. Moreover, since the network 102 itself does not include an interface and a route, the embodiment of the present application deletes the network 102 from the system, and assuming that the network and the route in the android system after the access of the third access device are as shown in fig. 11, the network and the route in the system after the network 102 is disconnected will be as shown in fig. 8.
It is added that if all non-default network disconnections are detected, the gateway route of the default network is added to the default network. When the non-default network is completely disconnected, only the interface eth0 is left in the default network 100, and the gateway route of eth0 is added to the network 100 in the embodiment of the application, so as to meet the requirement that the device accesses the internet.
Fig. 12 is a diagram of an application scenario of a multi-network communication method in the embodiment of the present application. The drawing comprises the following steps: terminal equipment 100, interface 1, interface 2, interface 3, and camera 1, camera 2 and camera 3 connected with the interface respectively. The interface 1 is connected to the camera 1 through a network 100, the interface 2 is connected to the camera 2 through a network 101, and the interface 3 is connected to the camera 3 through a network 102.
In some embodiments, if target data is sent to access devices of multiple target networks, an interface of an access device of each target network is searched in a default network, and the target data is distributed to a corresponding access device through each target network interface. For example, as shown in fig. 12, if the terminal device is connected with 3 cameras, the access devices of the multiple target networks are 3 cameras, and the interfaces corresponding to the 3 cameras are searched in the default network, such as interface 1, interface 2, and interface 3 in fig. 12, and the target data is distributed to the corresponding cameras through each camera interface; or, if the three cameras need to send the acquired pictures to the terminal device, the pictures can be simultaneously sent to the terminal device through respective corresponding interfaces. Compared with the prior art that only one default network can be kept online, and one default network corresponds to an interface of one access device, so that communication can be performed only with one access device.
It should be understood by those skilled in the art that the camera and the network interface shown in fig. 12 are intended to represent the operation of the terminal device related to the technical solution of the present application. Rather than to imply a limitation on the number, type, or location of the terminal devices and interfaces of fig. 12. It should be noted that the underlying concepts of the example embodiments of the present application may not be altered if additional modules are added or removed from the illustrated environments.
It should be noted that the multi-network communication method provided by the present application is not only applicable to the application scenario shown in fig. 12, but also applicable to other possible application scenarios, and the embodiments of the present application are not limited.
To sum up, the first non-gateway route is added to the default network and the default network is continuously used, so that the multiple access devices can simultaneously communicate through the non-gateway route included in the default network, the simultaneous communication between the terminal device and the multiple access devices is realized, the communication efficiency is improved, the problem of complex network conversion operation is avoided, and the user experience is improved.
Based on the same inventive concept, an embodiment of the present application further provides a multi-network communication apparatus 1300, as shown in fig. 13, the apparatus includes:
an access module 1301 configured to access an access device of a first network;
an establishing module 1302 configured to establish a first interface for the first network and allocate a first IP address to the first interface;
and an adjusting module 1303, configured to generate a first non-gateway route of the first network based on the first interface and the first IP address of the first network, add the first non-gateway route and the first interface to the second network, and keep the second network as a default network, if the second network is a default network.
In some embodiments, the apparatus further comprises:
a default network switching module configured to:
generating a network number of the first network;
if the default network is detected to be disconnected, selecting a new default network based on network priority;
adding a designated non-gateway route in the default network to the new default network based on the network number of the new default network, the designated non-gateway route being the remaining non-gateway routes in the default network except the non-gateway route of the default network.
In some embodiments, the adjustment module is further configured to delete a gateway route in the default network if the gateway route is stored in the default network.
In some embodiments, the adjustment module is further configured to delete non-gateway routes of the non-default network from the default network if a non-default network disconnection is detected.
In some embodiments, the apparatus further comprises:
the first sending module is configured to search an interface of each target network in the default network if target data are sent to access equipment of a plurality of target networks;
a distribution module configured to distribute the target data to corresponding access devices through interfaces of the access devices of the target networks, respectively.
Optionally, the apparatus further comprises:
the device comprises a receiving module, a processing module and a processing module, wherein the receiving module is configured to receive data to be processed sent by any equipment, and the data to be processed comprises an IP address of a target network;
the searching module is configured to search the default network for an interface identifier corresponding to the IP address of the target network;
and the second sending module is configured to send the data to be processed to the interface corresponding to the interface identifier for processing.
In some embodiments, the adjusting module is further configured to add the gateway route of the default network to the default network if all non-default network disconnections are detected.
In an exemplary embodiment, the present application also provides a computer readable storage medium comprising instructions, such as the memory 120 comprising instructions, executable by the processor 180 of the terminal device 100 to perform the above-described multi-network communication method. Alternatively, the computer readable storage medium may be a non-transitory computer readable storage medium, for example, which may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising a computer program which, when executed by the processor 180, implements the multi-network communication method as provided herein.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method of multi-network communication, the method comprising:
an access device accessing a first network;
establishing a first interface for the first network, and allocating a first IP address for the first interface;
and if the second network is the default network, generating a first non-gateway route of the first network based on the first interface and the first IP address of the first network, adding the first non-gateway route and the first interface into the second network, and keeping the second network as the default network.
2. The method of claim 1, further comprising:
generating a network number of the first network;
if the default network is detected to be disconnected, selecting a new default network based on network priority;
adding a designated non-gateway route in the default network to the new default network based on the network number of the new default network, the designated non-gateway route being the remaining non-gateway route in the default network except for the non-gateway route of the default network.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
and if the gateway route is stored in the default network, deleting the gateway route in the default network.
4. The method of claim 1, further comprising:
and if the disconnection of the non-default network is detected, deleting the non-gateway route of the non-default network from the default network.
5. The method of claim 1, further comprising:
if target data are sent to access equipment of a plurality of target networks, searching an interface of each target network in the default network;
and distributing the target data to corresponding access equipment through the interface of the access equipment of each target network.
6. The method of claim 1, further comprising:
receiving data to be processed sent by any access equipment, wherein the data to be processed comprises an IP address of a target network;
searching an interface identifier corresponding to the IP address of the target network in the default network;
and sending the data to be processed to an interface corresponding to the interface identifier for processing.
7. The method of claim 1, further comprising:
and if all the non-default networks are detected to be disconnected, adding the gateway route of the default network into the default network.
8. A terminal device, comprising:
a display, a processor, and a memory;
the display is used for displaying information;
the memory to store the processor-executable instructions;
the processor is configured to execute the instructions to implement the multi-network communication method of any of claims 1-7.
9. A computer-readable storage medium, comprising:
the instructions in the computer readable storage medium, when executed by the terminal device, enable the terminal device to perform the multi-network communication method of any one of claims 1-7.
10. A computer program product, comprising:
a computer program;
the computer program, when executed by a processor, implements a multi-network communication method as claimed in any one of claims 1-7.
CN202210302706.8A 2022-03-24 2022-03-24 Multi-network communication method, terminal device, storage medium, and program product Pending CN114666864A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210302706.8A CN114666864A (en) 2022-03-24 2022-03-24 Multi-network communication method, terminal device, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210302706.8A CN114666864A (en) 2022-03-24 2022-03-24 Multi-network communication method, terminal device, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN114666864A true CN114666864A (en) 2022-06-24

Family

ID=82031658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210302706.8A Pending CN114666864A (en) 2022-03-24 2022-03-24 Multi-network communication method, terminal device, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN114666864A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277410A (en) * 2022-08-04 2022-11-01 深圳市共进电子股份有限公司 Gateway adjusting method, device, electronic equipment and storage medium
CN115296951A (en) * 2022-07-05 2022-11-04 青岛海信移动通信技术股份有限公司 Data packet sending method, device, equipment and medium
CN115883383A (en) * 2022-12-09 2023-03-31 山东有人物联网股份有限公司 Network expansion communication method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357373A (en) * 2015-10-08 2016-02-24 广州中海达定位技术有限公司 Method and system for simultaneously using plurality of networks based on Android system
CN108347351A (en) * 2018-01-26 2018-07-31 广州视源电子科技股份有限公司 Method, device and system for compatibility of dual Ethernet cards of equipment
CN110881196A (en) * 2019-10-12 2020-03-13 上海商米科技集团股份有限公司 Mobile terminal communication method based on android system, mobile terminal and readable storage medium
CN113543146A (en) * 2021-07-16 2021-10-22 杭州迈冲科技有限公司 Network coexistence control method and device based on Android system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357373A (en) * 2015-10-08 2016-02-24 广州中海达定位技术有限公司 Method and system for simultaneously using plurality of networks based on Android system
CN108347351A (en) * 2018-01-26 2018-07-31 广州视源电子科技股份有限公司 Method, device and system for compatibility of dual Ethernet cards of equipment
CN110881196A (en) * 2019-10-12 2020-03-13 上海商米科技集团股份有限公司 Mobile terminal communication method based on android system, mobile terminal and readable storage medium
CN113543146A (en) * 2021-07-16 2021-10-22 杭州迈冲科技有限公司 Network coexistence control method and device based on Android system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115296951A (en) * 2022-07-05 2022-11-04 青岛海信移动通信技术股份有限公司 Data packet sending method, device, equipment and medium
CN115277410A (en) * 2022-08-04 2022-11-01 深圳市共进电子股份有限公司 Gateway adjusting method, device, electronic equipment and storage medium
CN115277410B (en) * 2022-08-04 2024-04-12 深圳市共进电子股份有限公司 Gateway adjustment method, device, electronic equipment and storage medium
CN115883383A (en) * 2022-12-09 2023-03-31 山东有人物联网股份有限公司 Network expansion communication method, device, equipment and storage medium
CN115883383B (en) * 2022-12-09 2024-05-10 山东有人物联网股份有限公司 Network extension communication method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN114666864A (en) Multi-network communication method, terminal device, storage medium, and program product
EP4013003A1 (en) Communication protocol switching method, apparatus and system
CN111294884A (en) Communication terminal supporting dual-card dual-standby single-pass and data service switching method
CN116709226B (en) Communication relay method, electronic device, communication system, and storage medium
CN114679752B (en) Method for sharing wireless communication capability by double systems and terminal equipment
CN113727289A (en) Electronic equipment and communication method
CN114422566A (en) Multi-device connection method, device, system, device and storage medium
CN112583822B (en) Communication apparatus and communication method
CN114666395B (en) Dual-system network sharing method and device
CN112825072A (en) Communication terminal and data sharing method
CN112000411B (en) Mobile terminal and display method of recording channel occupation information thereof
CN113543366B (en) Mobile terminal and call method, call server and call system thereof
CN111600862B (en) User account management method and device
CN113938890A (en) Data sharing method and terminal equipment
CN115884142A (en) Bluetooth connection method and electronic equipment
CN114071652A (en) Method for establishing binding relationship and related equipment
CN112954622A (en) Mobile terminal and short message sending method thereof
CN115802516A (en) Wi-Fi direct communication method and device
CN114007202A (en) Method for establishing binding relationship and related equipment
CN115150265B (en) Dual-system data processing method, device and apparatus
CN114501389B (en) Mobile terminal, network sharing method and storage medium
CN114416011B (en) Terminal, audio control method and storage medium
CN114595203B (en) File synchronization method based on dual systems, terminal equipment and storage medium
CN115002820B (en) Call state monitoring method, device, equipment and storage medium
CN112668061B (en) Electronic equipment and equipment code reporting method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: Shandong City, Qingdao Province, Jiangxi City Road No. 11

Applicant after: Qingdao Hisense Mobile Communication Technology Co.,Ltd.

Address before: Shandong City, Qingdao Province, Jiangxi City Road No. 11

Applicant before: HISENSE MOBILE COMMUNICATIONS TECHNOLOGY Co.,Ltd.

Country or region before: China