Network communication method, device, equipment, storage medium and computer program product

By using multiple sub-network and protocol stack processing modules in the communication system of Android devices and combining redundant network mechanisms, data processing congestion and network failure problems caused by multiple independent network hardware sharing the same protocol stack in the prior art are solved. Achieve higher network communication reliability and stability.

CN119520636APending Publication Date: 2025-02-25SHENZHEN EMDOOR DIGITAL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411372409.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Existing Android devices use the same network protocol stack for data interaction under multiple independent network hardware, resulting in congestion in data processing in complex field environments, and the possibility of data loss. The network cannot communicate normally when a single network device fails, resulting in data Being interrupted.

Method used

By establishing at least two subnets and network driver transmission layers in the communication system, using multiple protocol stack processing modules for data analysis, and selecting communication subnets and redundant subnets for communication through redundant network mechanisms, ensuring data processing Reliability and stability.

Benefits of technology

It improves the reliability and stability of network communication, avoids data processing congestion and loss, and ensures the continuity and security of network communication in complex field environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520636A_ABST
    Figure CN119520636A_ABST
Patent Text Reader

Abstract

The invention discloses a network communication method and device, equipment, a storage medium and a computer program product, and relates to the technical field of network communication, and the network communication method comprises the steps: inputting external network data into a protocol stack processing module of a network drive transmission layer through a sub-network, the sub-networks are used for receiving external network data and analyzing the external network data through the protocol stack processing module to obtain analyzed data, and the sub-networks are in one-to-one correspondence with the protocol stack processing module; and returning the analysis data to a socket of a preset application layer, communicating with the external network through the sub-network, and performing data reading and writing by the preset application layer through the socket. The reliability of network communication can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a network communication method, apparatus, device, storage medium and computer program product. Background Art

[0002] The same independent network hardware on an Android device usually uses the same network protocol stack to interact with external network devices, and basically each independent network processes its own related data content. Therefore, this method has shortcomings in terms of complex on-site environments and data security requirements. For example, multiple networks on the market are usually connected to the same switch, and then multiple network data are communicated. At this time, each network on the Android device will receive a large amount of data. Since several networks parse and process data on the same network protocol, data processing will be congested, and there is a possibility of data loss. In addition, due to the complex on-site environment, if a single network device fails, the network will not be able to communicate with the outside world, and there may be situations where data is interrupted, resulting in related controls not being processed in time.

[0003] Therefore, how to improve the reliability of network communication is a problem that needs to be solved urgently. Summary of the invention

[0004] The main purpose of this application is to provide a network communication method, device, equipment, storage medium and computer program product, aiming to solve the technical problem of how to improve the reliability of network communication.

[0005] To achieve the above object, the present application provides a network communication method, which is executed by a communication system, wherein the communication system includes at least two sub-networks and a network driver transport layer, wherein the network driver transport layer includes at least two protocol stack processing modules, and the network communication method includes:

[0006] Inputting external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parsing the external network data through the protocol stack processing module to obtain parsed data, wherein the sub-network corresponds to the protocol stack processing module one by one;

[0007] The parsed data is returned to the socket of the preset application layer, and communication is performed with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

[0008] In one embodiment, before the step of the application layer reading and writing data through the socket, the following steps are included:

[0009] Two of the subnets are grouped together to form a redundant network, and the redundant network is used to communicate with an external network, wherein the redundant network includes a first subnet and a second subnet, and the first subnet is a subnet that communicates with an external network in a default setting;

[0010] Selecting a communication subnet from the first subnet and the second subnet according to the data reception conditions of the first subnet and the second subnet, wherein the communication subnet is a subnet for communicating with the external network;

[0011] The selection of the communication subnet is adjusted according to the connection status of the communication subnet.

[0012] In one embodiment, the step of selecting a communication subnet from the first subnet and the second subnet based on the data reception conditions of the first subnet and the second subnet includes:

[0013] If the data reception of the first subnet is normal, selecting the first subnet as the communication subnet;

[0014] If the data reception situation of the first subnet is abnormal and the data reception situation of the second subnet is normal, the second subnet is selected as the communication subnet.

[0015] In one embodiment, the redundant network includes the communication subnet and the redundant subnet, both of which receive external network data, and the communication subnet can send data to the external network, and the step of adjusting the selection of the communication subnet according to the connection status of the communication subnet also includes:

[0016] If the connection status of the communication subnet is normal, communicating with the external network through the communication subnet;

[0017] If the connection status of the communication subnet is abnormal, and the connection status of the redundant subnet is normal, communicating with the external network through the redundant network;

[0018] If the connection status between the communication subnet and the redundant subnet is abnormal, an alarm signal is issued.

[0019] In one embodiment, the step of forming a redundant network by grouping two of the sub-networks further comprises:

[0020] The first subnet and the second subnet are combined into the redundant network through network multicast.

[0021] In one embodiment, before the step of inputting the external network data into the protocol stack processing module of the network driver transport layer through the sub-network and parsing the external network data through the protocol stack processing module to obtain the parsed data, the step includes:

[0022] The sub-network is bound to the protocol stack processing module, and a buffer of the sub-network is set.

[0023] In addition, to achieve the above-mentioned purpose, the present application also provides a network communication device, the network communication device comprising:

[0024] A data processing module, which inputs external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parses and processes the external network data through the protocol stack processing module to obtain parsed data, and the sub-network corresponds to the protocol stack processing module one by one;

[0025] The communication module returns the parsed data to the socket of the preset application layer, communicates with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

[0026] In addition, to achieve the above-mentioned purpose, the present application also provides a network communication device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to execute the steps of the network communication method as described above.

[0027] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, which is a computer-readable storage medium, and a program for implementing the network communication method is stored on the computer-readable storage medium. The program for implementing the network communication method is executed by a processor to implement the steps of the network communication method as described above.

[0028] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned network communication method are implemented.

[0029] The present application provides a network communication method, which inputs external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parses and processes the external network data through the protocol stack processing module to obtain parsed data, and the sub-network corresponds to the protocol stack processing module one by one; the parsed data is returned to the socket of the preset application layer, and communication is performed with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

[0030] In summary, the present application establishes multiple protocol stack processing modules so that different sub-networks can perform data communication in different protocol stack processing modules, thereby overcoming the technical defects of using the same protocol stack processing module in a complex field environment and requiring insufficient data security, and improving the reliability of the network communication method. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0033] Figure 1 A flowchart of the first embodiment of the network communication method of the present application is provided;

[0034] Figure 2 A schematic diagram of data processing of the network communication method of the present application provided for an embodiment of the network communication method of the present application;

[0035] Figure 3 A schematic diagram of data processing of a traditional single network protocol stack network communication method provided in accordance with an embodiment of the network communication method of the present application;

[0036] Figure 4 A flowchart of the second embodiment of the network communication method of the present application is provided;

[0037] Figure 5 A schematic diagram of the principle of communication between a redundant network and an external network provided in an embodiment of the present application;

[0038] Figure 6 A brief flowchart of a network communication method provided in accordance with the first embodiment of the present application;

[0039] Figure 7 This is a flow chart of the protocol stack processing module binding and redundancy mechanism in the embodiment of the present application;

[0040] Figure 8 This is a schematic diagram of the module structure of the network communication device according to an embodiment of the present application;

[0041] Fig. 9 It is a schematic diagram of the structure of the network communication device in the embodiment of the present application.

[0042] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0043] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0044] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0045] The main solution of the present application is: inputting external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parsing and processing the external network data through the protocol stack processing module to obtain parsed data, and the sub-network corresponds to the protocol stack processing module one by one; returning the parsed data to the socket of the preset application layer, communicating with the external network through the sub-network, and the preset application layer reading and writing data through the socket.

[0046] In the market, multiple networks are usually connected to the same switch, and then multiple network data are communicated. At this time, each network on the Android device will receive a large amount of data. Since several networks parse and process data on the same network protocol, data processing will be congested, resulting in the possibility of data loss. In addition, due to the complex on-site environment, if a single network device fails, the network will be unable to communicate with the outside world, and there will be data interruptions, resulting in related controls not being processed in time.

[0047] Therefore, how to improve the reliability of network communication is a problem that needs to be solved urgently.

[0048] The present application establishes multiple protocol stack processing modules so that different sub-networks can perform data communication in different protocol stack processing modules, thereby overcoming the technical defects of using the same protocol stack processing module in complex field environments and insufficient data security requirements, and improving the reliability of the network communication method.

[0049] It should be noted that the execution subject of this embodiment may be a communication system, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a network communication device capable of realizing the above functions, etc., and this embodiment does not specifically limit this. The following takes the communication system as the execution subject as an example to illustrate this embodiment and the following embodiments.

[0050] Based on this, the present application proposes a network communication method of the first embodiment, please refer to Figure 1 The network communication method is executed by a communication system, the communication system includes at least two sub-networks and a network driver transmission layer, the network driver transmission layer includes at least two protocol stack processing modules, and the network communication method includes steps S10 to S20:

[0051] It should be noted that the network driver transport layer refers to the part of the communication system that is responsible for the interaction between the data link layer and the transport layer, and the protocol stack processing module is used to independently process the data of the corresponding sub-network.

[0052] Step S10, inputting the external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parsing the external network data through the protocol stack processing module to obtain parsed data, wherein the sub-network corresponds to the protocol stack processing module one by one;

[0053] It should be noted that subnetworks refer to network entities used for data transmission and reception in a communication system, and they correspond one-to-one to protocol stack processing modules. External network data refers to data received from sources outside the communication system. These data may come from the Internet, a local area network, a wide area network, or any other type of network. Parsed data refers to data processed by a protocol stack processing module.

[0054] It can be understood that the network driver transport layer is mainly responsible for providing data transmission services on an end-to-end basis, ensuring that data can be transmitted reliably or unreliably between two terminal devices in the network. The external network sends data to the sub-network for processing through the network driver transport layer, and then sends it to the upper layers such as the application layer and presentation layer.

[0055] In a feasible embodiment, external network data enters the network processing protocol stack (protocol stack processing module) through the network driver transport layer, and is bound to the corresponding network processing protocol stack through the network device (sub-network) to perform UDP (User Datagram Protocol) / TCP (Transmission Control Protocol) data reception and transmission processing. The processed data is returned to the upper application network (preset application layer) socket handle, and the upper layer can now perform data transceiver interface recv (receive) and send (send) operations through the socket handle.

[0056] Furthermore, if Figure 2 and Figure 3 As shown, Figure 2 To illustrate the data processing situation of the communication method of this embodiment, Figure 3 The data processing of the traditional single network protocol stack network communication method is as follows:

[0057] Among them, Tcp and udp represent data types, Recv-Q is the amount of received data, Send-Q is the amount of sent data, Local Address is the local address, Foreign Address is the external address, and State is the status column showing the sending status.

[0058] pass Figure 3 It can be seen from the comparison that when multiple networks share a single network protocol stack, the protocol stack often has data that is not emptied. For example, 2056, 22684, etc. are all cases where the data on the corresponding network is not processed in time. Figure 2 It can be seen that the data retained in the communication method of this embodiment is basically 0, that is, all data has been processed in time.

[0059] In a feasible embodiment, step S10 further includes step S101:

[0060] Step S101, binding the sub-network to the protocol stack processing module, and setting a buffer of the sub-network.

[0061] It should be noted that the buffer refers to the data buffer before the sub-network receives and processes the data and sends it to the socket of the preset application layer, that is, buffer.

[0062] It is understandable that each sub-network is generated by a network device and bound to a protocol stack processing module to establish a one-to-one correspondence between the sub-network and the protocol stack processing module, thereby achieving separate processing of data in each sub-network.

[0063] In a feasible embodiment, first, the corresponding sub-network is bound through the java.net.Socket under the Android system. Then, the buffer size of the sub-network UDP / TCP socket is set in the bound sub-network. The buffer is an indispensable part of data transmission and processing. Correct use and management of the buffer is crucial to ensure system performance and security. Finally, the sizes of the respective send and receive buffers are further set through the Android system mSocket.setSendBufferSize\mSocket.ReceiveBufferSize.

[0064] This embodiment implements the binding of the sub-network with the protocol stack processing module through the java.net.Socket under the Android system, which can ensure that the network communication of the application program is targeted at a specific network interface, thereby improving the stability and performance of the connection, especially in a multi-network environment.

[0065] Step S20, returning the parsed data to the socket of the preset application layer, communicating with the external network through the sub-network, and the preset application layer reading and writing data through the socket.

[0066] It should be noted that the default application layer refers to the layer responsible for providing services or functions directly to users in network communication. The default application layer is the highest layer in the network layered model. A socket is a communication endpoint that allows a program to send data to or receive data from the network.

[0067] It can be understood that data communication at the application layer is achieved through sockets, and data communication with the external network is achieved through the sub-network bound to the network device, thereby achieving communication between the user and the external network among multiple network devices.

[0068] The communication method of this embodiment realizes network communication by establishing multiple protocol stack processing modules to individually process the data of each sub-network, thereby solving the problem of network data loss caused by untimely network protocol stack processing during network large data flow communication, and thus improving the reliability of network communication.

[0069] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and no further description will be given later. Figure 4 , the network communication method further includes:

[0070] Step S01, forming a redundant network with two of the subnets as a group, and communicating with an external network through the redundant network, wherein the redundant network includes a first subnet and a second subnet, and the first subnet is a subnet for communicating with an external network in a default setting;

[0071] It should be noted that a redundant network refers to a network that communicates by configuring two subnets. The first subnet refers to the main network in the redundant network that communicates with the external network by default, that is, in general, the first subnet is responsible for receiving and sending external network data, while the second subnet does not send data to the external network, but receives external network data from the external network.

[0072] like Figure 5 As shown, Figure 5 The figure is a schematic diagram of the principle of redundant network communicating with external network, where LAN1, LAN2, LAN3 and LANn refer to sub-networks. The sub-networks communicate with external network through switches, and sub-networks form redundant network in groups of two. Generally, the sub-network with the earlier serial number is the first sub-network by default. For example, in the redundant network of LAN1 and LAN2, LAN1 is the first sub-network by default, and LAN2 is the second sub-network.

[0073] It is understandable that there may be more than four sub-networks. When the number of sub-networks exceeds four, if two-by-two sub-networks are used to form a redundant network, it is still regarded as using the network communication method of this embodiment.

[0074] In another feasible embodiment, the redundant network is formed by more than two sub-networks, which can further improve the reliability of network communication.

[0075] In a feasible embodiment, the two sub-networks in step S01 are grouped together, and the step of forming a redundant network further includes step S011:

[0076] Step S011: The first subnet and the second subnet are combined into the redundant network through network multicast.

[0077] It can be understood that network multicast is an efficient network communication technology that allows a data packet to be sent from a source host to a specific group of recipients rather than a single destination or all devices in the network. This method can significantly save bandwidth and reduce network congestion when transmitting data to multiple recipients compared to unicast and broadcast. In this embodiment, the external network is equivalent to the source host and the subnet is equivalent to the recipient.

[0078] This embodiment uses network multicast, which can significantly save bandwidth and reduce network congestion compared to unicast and broadcast, thereby improving data transmission efficiency, reducing network load, and can transmit across network segments, only transmitting data streams to places where there are receivers, thereby avoiding traffic redundancy.

[0079] Step S02, selecting a communication subnet from the first subnet and the second subnet according to the data reception conditions of the first subnet and the second subnet, wherein the communication subnet is a subnet for communicating with the external network;

[0080] It is understandable that, under normal circumstances, the first subnet is a communication subnet, and when a communication error occurs in the first subnet, the second subnet needs to be selected as the communication subnet.

[0081] In a feasible embodiment, the step S02 of selecting a communication subnet from the first subnet and the second subnet according to the data reception conditions of the first subnet and the second subnet further includes steps A10 to A20:

[0082] Step A10, if the data reception of the first subnet is normal, selecting the first subnet as the communication subnet;

[0083] It is understandable that the normal data reception means that the first subnet can receive the external network data sent by the external network. Regardless of whether the second subnet can normally receive the external network data, the first subnet is selected as the communication subnet by default.

[0084] Step A20: If the data reception situation of the first subnet is abnormal and the data reception situation of the second subnet is normal, the second subnet is selected as the communication subnet.

[0085] It is understandable that when the first subnet cannot receive external network data, the second subnet needs to be detected. If the second subnet can normally receive external network data, the second subnet is used as a communication subnet.

[0086] This embodiment selects a communication network based on data reception conditions, thereby avoiding abnormalities in network communication of the entire communication system caused by abnormal data reception in the first subnet in the redundant network, thereby improving the reliability of the network communication method of this embodiment.

[0087] Step S03: adjusting the selection of the communication subnet according to the connection status of the communication subnet.

[0088] It is understandable that during network communication, the network connection may be temporarily disconnected, and the communication subnet cannot be replaced in time by selecting the communication subnet based on the data reception situation.

[0089] In a feasible embodiment, by constructing a process to monitor the link status (connection status) of the subnet, and by monitoring the link status in real time, after selecting the communication subnet based on the data reception situation, the communication subnet is further selected. Through this embodiment, after a communication failure occurs in the communication subnet, the communication subnet can be replaced more quickly than when the communication subnet is selected only based on the data reception situation, thereby improving the reliability and security of network communication.

[0090] In another feasible embodiment, after selecting a communication subnet according to the link status, a communication subnet is further selected according to the situation of receiving external network data by the communication subnet. The reliability of network communication can be improved by the method of this embodiment.

[0091] In another feasible embodiment, the communication subnet is selected by the data reception situation while the link status of the subnet is monitored to adjust the communication subnet. This embodiment improves the rate of network communication by comprehensively selecting the communication subnets at the same time.

[0092] In a feasible embodiment, the redundant network includes the communication subnet and the redundant subnet, the communication subnet and the redundant subnet both receive external network data, the communication subnet can send data to the external network, and step S03 also includes steps B10 to B30:

[0093] It should be noted that, generally, that is, when the first subnet can communicate with the external network normally, the first subnet is a communication subnet and the second subnet is a redundant subnet.

[0094] Step B10, if the connection status of the communication subnet is normal, communicate with the external network through the communication subnet;

[0095] It is understandable that if there is no abnormality in the connection status of the communication subnet, there is no need to replace the communication subnet, and communication with the outside is performed through the original communication subnet.

[0096] Step B20, if the connection status of the communication subnet is abnormal, and the connection status of the redundant subnet is normal, communicate with the external network through the redundant network;

[0097] It is understandable that when the connection status of the communication subnet is abnormal, it is necessary to determine whether the connection status of the redundant subnet is abnormal. When the connection status of the redundant subnet is normal, communication with the external network is performed through the redundant subnet, and the redundant subnet is equivalent to a communication network.

[0098] Step B30: If the connection status between the communication subnet and the redundant subnet is abnormal, an alarm signal is issued.

[0099] When the connection status of the communication subnet and the redundant subnet are both abnormal, an alarm signal is issued to alert the user of the abnormality and remind the user that the network communication is abnormal.

[0100] This embodiment selects a communication subnet according to the connection status, which can improve the reliability, stability and security of the communication system, and can ensure the continuous operation of network communications and continuous transmission of data even when network conditions are not ideal or a failure occurs.

[0101] For example, to help understand the technical concept or technical principle of the network communication method after combining this embodiment with the above-mentioned embodiment 1 and embodiment 2, please refer to Figure 6 , Figure 6 A brief flow chart of a network communication method is provided, as follows:

[0102] External network data enters the network processing protocol stack (pre-opened memory space) through the network driver transport layer, and is bound to the corresponding network protocol stack processing space (protocol stack processing module) through the corresponding network device to perform UDP / TCP data reception and transmission processing. The processed data is returned to the upper application network (application layer) socket handle (socket), and the upper layer can now perform data reception and transmission interface recv and send operations through the socket handle.

[0103] Before performing network read and write operations on the upper-layer socket, the redundancy judgment arbitration unit is entered, and the arbitration unit performs relevant logical judgments and selects which network is used as the main network to communicate with the external network device, that is, selects the communication subnet to communicate with the external network device.

[0104] Among them, LAN1, LAN2, LAN3 and LANn refer to sub-networks, each of which is generated by a network device and bound to a protocol stack processing module through the network device.

[0105] For further information, please refer to Figure 7 , Figure 7 A flowchart of the protocol stack processing module binding and redundancy mechanism is provided, specifically:

[0106] Protocol stack processing module binding process:

[0107] The first step is to initialize the network driver, start the network communication system, and perform necessary configuration.

[0108] The second step is to configure the network protocol stack to adapt to different network environments and requirements.

[0109] The third step is to use network-related interfaces: use interfaces such as java.net.Socket for network communication.

[0110] The fourth step is to set the size of each independent protocol stack: set the buffer size for each protocol stack, and configure the receive and send buffer of each network through the mSocket.setSendBufferSize and mSocket.setReceiveBufferSize methods.

[0111] Redundancy mechanism process:

[0112] The first step is network communication initialization: complete the initialization of network communication.

[0113] The second step is to determine the network link status: check the network connection status and determine whether both networks are in an abnormal state.

[0114] In the third step, if the network link status is abnormal, the link status of the two sub-networks in the redundant network is monitored. If the link status monitoring of the two sub-networks is abnormal, an abnormal alarm is issued. If there is a normal sub-network, the normal sub-network is selected as the communication sub-network for network sending and receiving communications.

[0115] Step 4: If the network link status is normal, enter the transceiver interface: set the network's receiving and sending interfaces.

[0116] Step 5. Select the sending network through the network receiving data: When LAN1 and LAN2 are both normal, LAN1 is selected by default for data sending.

[0117] Step 6: External network multicast communication: Communicate with external nodes through multicast, and use specific port numbers to distinguish different communication nodes.

[0118] Among them, the network refers to the redundant network, and LAN refers to the subnetwork.

[0119] It can be understood that the network communication method of the present application is aimed at the network communication under the Android system through this multi-protocol stack redundancy mechanism, which greatly improves the loss of network data caused by the untimely processing of the network protocol stack during the network large data flow communication. At the same time, the network redundancy mechanism brings a reliable and secure communication mechanism to the communication control system of the entire network. Combined with the current communication control is mainly transmitted through the network, the present invention has good security and reliable communication advantages in complex network environments.

[0120] The present application also provides a network communication device. Figure 8 , the network communication device comprises:

[0121] The data processing module 10 inputs the external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parses and processes the external network data through the protocol stack processing module to obtain parsed data, and the sub-network corresponds to the protocol stack processing module one by one;

[0122] The communication module 20 returns the parsed data to the socket of the preset application layer, communicates with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

[0123] Optionally, the communication module 20 is further used for:

[0124] Two of the subnets are grouped together to form a redundant network, and the redundant network is used to communicate with an external network, wherein the redundant network includes a first subnet and a second subnet, and the first subnet is a subnet that communicates with an external network in a default setting;

[0125] Selecting a communication subnet from the first subnet and the second subnet according to the data reception conditions of the first subnet and the second subnet, wherein the communication subnet is a subnet for communicating with the external network;

[0126] The selection of the communication subnet is adjusted according to the connection status of the communication subnet.

[0127] Optionally, the communication module 20 is further used for:

[0128] If the data reception of the first subnet is normal, selecting the first subnet as the communication subnet;

[0129] If the data reception situation of the first subnet is abnormal and the data reception situation of the second subnet is normal, the second subnet is selected as the communication subnet.

[0130] Optionally, the redundant network includes the communication subnet and the redundant subnet, both of which receive external network data, and the communication subnet can send data to the external network, and the communication module 20 is further used for:

[0131] If the connection status of the communication subnet is normal, communicating with the external network through the communication subnet;

[0132] If the connection status of the communication subnet is abnormal, and the connection status of the redundant subnet is normal, communicating with the external network through the redundant network;

[0133] If the connection status between the communication subnet and the redundant subnet is abnormal, an alarm signal is issued.

[0134] Optionally, the communication module 20 is further used for:

[0135] The first subnet and the second subnet are combined into the redundant network through network multicast.

[0136] Optionally, the data processing module 10 is further used for:

[0137] The sub-network is bound to the protocol stack processing module, and a buffer of the sub-network is set.

[0138] The network communication device provided in the embodiment of the present application adopts the network communication method in the above embodiment, which can solve the technical problem of how to improve the reliability of network communication. Compared with the prior art, the beneficial effects of the network communication device provided in the embodiment of the present application are the same as the beneficial effects of the network communication method provided in the above embodiment, and other technical features in the network communication device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0139] The present application provides a network communication device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the network communication method in the above-mentioned embodiment one.

[0140] Reference below Fig. 9 , which shows a schematic diagram of the structure of a network communication device suitable for implementing an embodiment of the present application. The network communication device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable App Displays), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The network communication device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0141] like Fig. 9As shown, the network communication device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read On ly Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the network communication device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 may allow the network communication device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a network communication device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.

[0142] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0143] The network communication device provided by the present application adopts the network communication method in the above embodiment, which can solve the technical problem of how to improve the reliability of network communication. Compared with the prior art, the beneficial effects of the network communication device provided by the present application are the same as the beneficial effects of the network communication method provided by the above embodiment, and other technical features in the network communication device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0144] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0145] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0146] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the network communication method in the above-mentioned embodiment.

[0147] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read On ly Memory), an erasable programmable read-only memory (EPROM: Erasable Programmab le Read On ly Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read On ly Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0148] The computer-readable storage medium may be included in the network communication device; or may exist independently without being installed in the network communication device.

[0149] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the network communication device, the network communication device: inputs external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parses and processes the external network data through the protocol stack processing module to obtain parsed data, and the sub-network corresponds to the protocol stack processing module one by one; returns the parsed data to the socket of the preset application layer, communicates with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

[0150] The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0151] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0152] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0153] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned network communication method, and can solve the technical problem of how to improve the reliability of network communication. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the network communication method provided by the above-mentioned embodiment, and will not be repeated here.

[0154] An embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above-mentioned network communication method when executed by a processor.

[0155] The computer program product provided by the present application can solve the technical problem of how to improve the reliability of network communication. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present application are the same as the beneficial effects of the network communication method provided by the above embodiment, which will not be repeated here.

[0156] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.

Claims

1. A network communication method, characterized in that: The network communication method is executed by a communication system, the communication system includes at least two sub-networks and a network driver transmission layer, the network driver transmission layer includes at least two protocol stack processing modules, and the network communication method includes: Inputting external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parsing the external network data through the protocol stack processing module to obtain parsed data, wherein the sub-network corresponds to the protocol stack processing module one by one; The parsed data is returned to the socket of the preset application layer, and communication is performed with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

2. The method according to claim 1, characterized in that Before the step of the application layer reading and writing data through the socket, the method includes: Two of the subnets are grouped together to form a redundant network, and the redundant network is used to communicate with an external network, wherein the redundant network includes a first subnet and a second subnet, and the first subnet is a subnet that communicates with an external network in a default setting; Selecting a communication subnet from the first subnet and the second subnet according to the data reception conditions of the first subnet and the second subnet, wherein the communication subnet is a subnet for communicating with the external network; The selection of the communication subnet is adjusted according to the connection status of the communication subnet.

3. The method according to claim 2, characterized in that The step of selecting a communication subnet from the first subnet and the second subnet according to the data reception conditions of the first subnet and the second subnet comprises: If the data reception of the first subnet is normal, selecting the first subnet as the communication subnet; If the data reception situation of the first subnet is abnormal and the data reception situation of the second subnet is normal, the second subnet is selected as the communication subnet.

4. The method according to claim 2, characterized in that The redundant network includes the communication subnet and the redundant subnet, both of which receive external network data, and the communication subnet can send data to the external network. The step of adjusting the selection of the communication subnet according to the connection status of the communication subnet also includes: If the connection status of the communication subnet is normal, communicating with the external network through the communication subnet; If the connection status of the communication subnet is abnormal, and the connection status of the redundant subnet is normal, communicating with the external network through the redundant network; If the connection status between the communication subnet and the redundant subnet is abnormal, an alarm signal is issued.

5. The method according to claim 2, characterized in that The step of forming a redundant network by taking two of the sub-networks as a group also includes: The first subnet and the second subnet are combined into the redundant network through network multicast.

6. The method according to claim 1, characterized in that Before the step of inputting the external network data into the protocol stack processing module of the network driver transmission layer through the sub-network and parsing the external network data through the protocol stack processing module to obtain the parsed data, the step includes: The sub-network is bound to the protocol stack processing module, and a buffer of the sub-network is set.

7. A network communication device, characterized in that: The network communication device is executed by a communication system, the communication system includes at least two sub-networks and a network driver transmission layer, the network driver transmission layer includes at least two protocol stack processing modules, and the device includes: A data processing module, which inputs external network data into the protocol stack processing module of the network driver transmission layer through the sub-network, and parses and processes the external network data through the protocol stack processing module to obtain parsed data, and the sub-network corresponds to the protocol stack processing module one by one; The communication module returns the parsed data to the socket of the preset application layer, communicates with the external network through the sub-network, and the preset application layer reads and writes data through the socket.

8. A network communication device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the network communication method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the network communication method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the network communication method according to any one of claims 1 to 6 are implemented.