Communication management method and device, equipment, storage medium and vehicle

By closing the communication between the protocol stack and the network card abstraction layer when the communication link is disconnected, and completely closing the protocol stack when there is no communication event, the problems of data loss and resource waste in the existing technology are solved, and communication efficiency is improved.

CN118740682APending Publication Date: 2024-10-01BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310339755.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the existing technology, when the communication link is disconnected, the protocol stack continues to send data packets, resulting in data loss and resource waste, and reducing communication efficiency.

Method used

When the communication link is disconnected, the communication between the protocol stack and the network card abstraction layer is closed, and the protocol stack is completely closed when there is no communication event to avoid data transmission and resource waste.

Benefits of technology

It reduces data loss and resource waste, improves communication efficiency, ensures no data communication when the link is disconnected, and avoids data packet loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740682A_ABST
    Figure CN118740682A_ABST
Patent Text Reader

Abstract

The invention discloses a communication management method and device, equipment, a storage medium and a vehicle. The method comprises the steps that a first instruction sent by a network state management module is received, and the first instruction is generated by the network state management module under the condition that a communication link is disconnected; in response to the first instruction, closing communication between a protocol stack and a network card abstraction layer; detecting whether a communication event exists between the protocol stack and an upper-layer application or not; and closing the protocol stack under the condition that the communication event does not exist. According to the communication management method provided by the embodiment of the invention, the communication efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communication technology, and in particular, relates to a communication management method, device, equipment, storage medium and vehicle. Background Art

[0002] Generally, the Ethernet state manager may include five sub-states, namely OFFLINE, WAIT_TRCVLINK, WAIT_ONLINE, ONLINE, and WAIT_OFFLINE. Before receiving a communication request, the Ethernet state manager may be in the OFFLINE state. After receiving the communication request, the network card may be activated and enter the WAIT_TRCVLINK state waiting for link activation. After the link state is ready, the WAIT_ONLINE state waiting for protocol stack activation may be entered. After the protocol stack is activated, the communication may be turned on in the ONLINE state. If communication needs to be turned off, the protocol stack may be turned off. Waiting for the protocol stack to be turned off may correspond to the WAIT_OFFLINE state. The above network state management method usually assumes that the link will not fail. In real life, the communication link may be temporarily disconnected or even damaged due to reasons such as line aging, vehicle bumps, and traffic accidents.

[0003] However, in the prior art, even when the communication link is disconnected, the protocol stack is still sending and receiving data, which results in data loss and resource waste, thereby reducing communication efficiency. Summary of the invention

[0004] Embodiments of the present application provide a communication management method, apparatus, device, storage medium, and vehicle, which can improve communication efficiency.

[0005] In a first aspect, an embodiment of the present application provides a communication management method, the method comprising:

[0006] receiving a first instruction sent by a network status management module, where the first instruction is generated by the network status management module when a communication link is disconnected;

[0007] In response to the first instruction, closing the communication between the protocol stack and the network card abstraction layer;

[0008] Detecting whether there is a communication event between the protocol stack and the upper layer application;

[0009] In the absence of the communication event, the protocol stack is closed.

[0010] In a possible implementation manner, the detecting whether there is a communication event between the protocol stack and the upper layer application includes:

[0011] querying socket states respectively corresponding to a plurality of sockets between the protocol stack and the upper layer application according to a preset period;

[0012] When the plurality of socket states are all in the closed state, it is determined that the communication event does not exist.

[0013] In a possible implementation, the detecting whether there is a communication event between the protocol stack and the upper layer application further includes:

[0014] querying socket states respectively corresponding to a plurality of sockets between the protocol stack and the upper layer application according to a preset period;

[0015] Get the number of times the socket status is queried;

[0016] When the number of queries reaches a preset number of queries and there is an open state among the plurality of socket states, querying a storage module of the protocol stack;

[0017] When the storage space of the storage module is full, it is determined that the communication event does not exist.

[0018] In a possible implementation, shutting down the protocol stack when the communication event does not exist includes:

[0019] In the absence of the communication event, generating a second instruction;

[0020] Sending the second instruction to the network status management module, where the second instruction is used to instruct the network status management module to enter a link activation waiting state;

[0021] Shut down the protocol stack.

[0022] In a second aspect, an embodiment of the present application provides a communication management method, the method comprising:

[0023] When the communication is in the on state, receiving the link status information sent by the network card abstraction layer;

[0024] In a case where the link status information indicates that the communication link is disconnected, generating a first instruction;

[0025] The first instruction is sent to the protocol stack, where the first instruction is used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer.

[0026] In a possible implementation manner, when the link status information indicates that the communication link is disconnected, generating a first instruction includes:

[0027] When the link status information indicates that the communication link is disconnected, the communication start state is switched to the communication buffer state, and the first instruction is generated.

[0028] In a possible implementation manner, after sending the first instruction to the protocol stack, the method further includes:

[0029] receiving a second instruction sent by the protocol stack, where the second instruction is generated by the protocol stack in the absence of a communication event;

[0030] In response to the second instruction, the communication buffer state is switched to the link activation waiting state.

[0031] In a possible implementation manner, after sending the first instruction to the protocol stack, the method further includes:

[0032] receiving a third instruction sent by the network card abstraction layer, wherein the third instruction is generated by the network card abstraction layer when the communication link is restored;

[0033] In response to the third instruction, the communication on state is entered.

[0034] In a third aspect, an embodiment of the present application provides a communication management device, the device comprising:

[0035] A first receiving module, configured to receive a first instruction sent by a network status management module, wherein the first instruction is generated by the network status management module when a communication link is disconnected;

[0036] A first closing module, configured to close the communication between the protocol stack and the network card abstraction layer in response to the first instruction;

[0037] A detection module, used to detect whether there is a communication event between the protocol stack and the upper layer application;

[0038] The second closing module is used to close the protocol stack when the communication event does not exist.

[0039] In a fourth aspect, an embodiment of the present application provides a communication management device, the device comprising:

[0040] A second receiving module is used to receive link status information sent by the network card abstraction layer when the communication is in the on state;

[0041] A generating module, configured to generate a first instruction when the link status information indicates that the communication link is disconnected;

[0042] The sending module is used to send the first instruction to the protocol stack, where the first instruction is used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer.

[0043] In a fifth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;

[0044] When the processor executes the computer program instructions, the method in any possible implementation method of the first aspect and the second aspect is implemented.

[0045] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, a method in any possible implementation method of the first aspect and the second aspect described above is implemented.

[0046] In a seventh aspect, an embodiment of the present application provides a vehicle, the vehicle comprising at least one of the following:

[0047] A communication management device as in any one of the embodiments of the third aspect;

[0048] A communication management device as in any one of the embodiments of the fourth aspect;

[0049] An electronic device as in any one of the embodiments of the fifth aspect;

[0050] A computer-readable storage medium as in any embodiment of the sixth aspect.

[0051] In the communication management method, device, equipment, storage medium and vehicle of the embodiment of the present application, when the communication link is disconnected, if the protocol stack still sends a data packet to the network card abstraction layer, it will cause the loss of the data packet. Therefore, by closing the communication between the protocol stack and the network card abstraction layer when the communication link is disconnected, the data packet in the protocol stack can be temporarily stored in the protocol stack, so that the loss of the data packet transmitted between the protocol stack and the network card abstraction layer can be reduced. Since the communication between the protocol stack and the network card abstraction layer has been closed, if there is still a communication event between the protocol stack and the upper layer application, the data transmitted to the protocol stack by the upper layer application can be temporarily stored in the protocol stack. In this way, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, the loss of data transmitted between the protocol stack and the upper layer application can be reduced. On the other hand, if there is no communication event between the protocol stack and the upper layer application and the protocol stack is still not closed, it will cause a waste of resources. Therefore, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, the waste of resources can be reduced under the premise of reducing data loss. In this way, through the embodiment of the present application, data loss and resource waste can be reduced, and communication efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0053] Figure 1 It is a structural diagram of a communication management system provided by an embodiment of the present application;

[0054] Figure 2 It is a flow chart of a communication management method provided in an embodiment of the present application;

[0055] Figure 3 It is a flowchart of another communication management method provided in an embodiment of the present application;

[0056] Figure 4 It is a flowchart of another communication management method provided in an embodiment of the present application;

[0057] Figure 5 It is a schematic diagram of a state transition provided by an embodiment of the present application;

[0058] Figure 6 is a schematic diagram of another state transition provided by an embodiment of the present application;

[0059] Figure 7 is a schematic diagram of another state transition provided in an embodiment of the present application;

[0060] Figure 8 It is a structural diagram of a communication management device provided in an embodiment of the present application;

[0061] Fig. 9 It is a structural diagram of another communication management device provided in an embodiment of the present application;

[0062] Fig.10 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0064] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.

[0065] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0066] As described in the background technology, in order to solve the problems of the prior art, the embodiments of the present application provide a communication management method, apparatus, device, storage medium and vehicle.

[0067] In an embodiment of the present application, the network status management module may include six sub-states, and the six sub-states and their corresponding conditions may be shown in Table 1 below.

[0068] Table 1

[0069]

[0070]

[0071] In Table 1, ACTIVE can represent a normal working state, and DOWN can represent an abnormal working state. In the communication link state, ACTIVE can specifically be a connected state, and DOWN can specifically be a disconnected state. In the network card state and transceiver state, ACTIVE can specifically be an open state, and DOWN can specifically be a closed state. In addition, in the protocol stack state, ONLINE can be an open state, and OFFLINE can be a closed state.

[0072] In addition, the embodiment of the present application provides a communication management system. The communication management system provided by the embodiment of the present application is introduced below.

[0073] Figure 1 FIG. 1 shows a schematic diagram of the structure of a communication management system provided by an embodiment of the present application. Figure 1As shown, the communication management system provided in the embodiment of the present application includes a first communication subsystem 11 and a second communication subsystem 12. Among them, the first communication subsystem 11 may include a communication module 111, a network status management module 112, a network card abstraction layer 113, a protocol stack 114, a socket adaptation layer 115 and an upper layer application 116. The first communication subsystem 11 and the second communication subsystem 12 can communicate through the communication link between the network card abstraction layers.

[0074] The following is an introduction to the communication management method provided in the embodiment of the present application.

[0075] Figure 2 FIG. 1 is a flow chart of a communication management method provided by an embodiment of the present application. Figure 2 As shown, the communication management method provided in the embodiment of the present application includes steps S210 to S290.

[0076] S210: When the network status management module is in a communication-on state, the network card abstraction layer monitors the state of the communication link.

[0077] Here, the network card abstraction layer may include a network card, a transceiver and a communication link. The network card abstraction layer may monitor the state of the communication link. In addition, the network state management module may specifically be an Ethernet state manager.

[0078] S220: When the communication link is disconnected, the network card abstraction layer sends link status information indicating that the communication link is disconnected to the network status management module.

[0079] Here, after the communication is started, if the communication link is disconnected, the network card abstraction layer can notify the network status management module that the communication link has been disconnected.

[0080] S230: The network status management module switches from the communication start state to the communication buffer state, and generates a first instruction.

[0081] Since the communication link is disconnected, if the protocol stack continues to send data packets to the network card abstraction layer, the data packets will be lost. Therefore, in order to avoid the loss of data packets, a first instruction can be generated. The first instruction can be used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer. In addition, since the communication link is disconnected, the network status management module can switch from the communication open state to the communication buffer state.

[0082] S240: The network status management module sends a first instruction to the protocol stack.

[0083] S250: The protocol stack closes the communication between the protocol stack and the network card abstraction layer in response to the first instruction.

[0084] After the protocol stack closes the communication between the protocol stack and the network card abstraction layer, the protocol stack can switch from the open state to the buffered state.

[0085] S260: The protocol stack detects whether there is a communication event between the protocol stack and the upper layer application.

[0086] Here, when the communication link is disconnected, data may still be exchanged between the protocol stack and the upper layer application. If data is exchanged between the protocol stack and the upper layer application, it can be considered that there is a communication event between the protocol stack and the upper layer application. Among them, the protocol stack and the upper layer application can exchange data through multiple sockets. If the socket states corresponding to multiple sockets are all closed, it can be considered that there is no communication event between the protocol stack and the upper layer application.

[0087] In addition, the protocol stack may include a storage module. When the communication between the protocol stack and the network card abstraction layer is closed and there is a communication event between the protocol stack and the upper layer application, the protocol stack may temporarily store the received data in the storage module. Based on this, if the storage space of the storage module is full, it can be considered that there is no communication event between the protocol stack and the upper layer application.

[0088] As an example, detecting whether a communication event exists between the protocol stack and the upper layer application may specifically be detecting whether a socket is closed and / or detecting whether a storage space in a storage module is full.

[0089] S270: When there is no communication event, close the protocol stack.

[0090] Here, if the protocol stack is closed when there is a communication event, data packets will be lost. Therefore, in order to reduce the loss of data packets, if the protocol stack has confirmed that there is no communication event between the protocol stack and the upper layer application, the protocol stack can be closed, that is, the protocol stack enters a closed state. On the other hand, if there is no communication event between the protocol stack and the upper layer application and the protocol stack is still not closed, it will cause a waste of resources. Therefore, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, it is possible to reduce the waste of resources while reducing data loss.

[0091] Thus, in the communication-on state, if the communication link is disconnected, by closing the communication between the protocol stack and the network card abstraction layer, the data packets in the protocol stack can be temporarily stored in the protocol stack, thereby reducing the loss of data packets transmitted between the protocol stack and the network card abstraction layer. Since the communication between the protocol stack and the network card abstraction layer has been closed, if there is still a communication event between the protocol stack and the upper-layer application, the data transmitted to the protocol stack by the upper-layer application can be temporarily stored in the protocol stack. In this way, by closing the protocol stack when there is no communication event between the protocol stack and the upper-layer application, the loss of data transmitted between the protocol stack and the upper-layer application can be reduced. In addition, by closing the protocol stack, resource waste can be reduced. In this way, through the embodiments of the present application, data loss and resource waste can be reduced, and communication efficiency can be improved.

[0092] Figure 3 FIG. 1 is a flow chart of a communication management method applied to a protocol stack provided in an embodiment of the present application. Figure 3 As shown, the communication management method provided in the embodiment of the present application includes the following steps:

[0093] S310, receiving a first instruction sent by a network status management module, where the first instruction is generated by the network status management module when a communication link is disconnected;

[0094] S320, in response to the first instruction, closing the communication between the protocol stack and the network card abstraction layer;

[0095] S330, detecting whether there is a communication event between the protocol stack and the upper layer application;

[0096] S340: When there is no communication event, close the protocol stack.

[0097] In the communication management method of the embodiment of the present application, when the communication link is disconnected, if the protocol stack still sends a data packet to the network card abstraction layer, it will cause the loss of the data packet. Therefore, by closing the communication between the protocol stack and the network card abstraction layer when the communication link is disconnected, the data packet in the protocol stack can be temporarily stored in the protocol stack, thereby reducing the loss of the data packet transmitted between the protocol stack and the network card abstraction layer. Since the communication between the protocol stack and the network card abstraction layer has been closed, if there is still a communication event between the protocol stack and the upper layer application, the data transmitted to the protocol stack by the upper layer application can be temporarily stored in the protocol stack. In this way, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, the loss of the data transmitted between the protocol stack and the upper layer application can be reduced. On the other hand, if there is no communication event between the protocol stack and the upper layer application and the protocol stack is still not closed, it will cause a waste of resources. Therefore, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, it is possible to reduce the waste of resources under the premise of reducing data loss. In this way, through the embodiment of the present application, data loss and resource waste can be reduced, and then communication efficiency can be improved.

[0098] The above steps of the method in the embodiment of the present application can be found in the above Figure 2 The relevant description of the illustrated embodiment will not be repeated here.

[0099] Based on this, in order to ensure that there is no data communication when the communication link is disconnected and avoid the loss of data packets, in some embodiments, when there is no communication event, shutting down the protocol stack may specifically include:

[0100] In the absence of a communication event, generating a second instruction;

[0101] Sending a second instruction to the network status management module, the second instruction is used to instruct the network status management module to enter a link activation waiting state;

[0102] Close the protocol stack.

[0103] Here, since the network status management module can be in a communication buffer state when the link is disconnected, the second instruction can be used to instruct the network status management module to switch from the link buffer state to the link activation waiting state. In this way, in the absence of a communication event, the protocol stack can be switched from the open state to the closed state, and the network status management module can be switched from the link buffer state to the link activation waiting state.

[0104] In this way, by sending a second instruction to the network status management module before the protocol stack enters the shutdown state, the network status management module can switch from the communication buffer state to the waiting link activation state when there is no communication event, thereby ensuring that there is no data communication when the communication link is disconnected, thereby avoiding the loss of data packets.

[0105] Based on this, in order to accurately determine whether there is a communication event between the protocol stack and the upper layer application, in some embodiments, the above-mentioned detection of whether there is a communication event between the protocol stack and the upper layer application may specifically include:

[0106] Querying socket states corresponding to multiple sockets between the protocol stack and the upper layer application according to a preset period;

[0107] When the states of the plurality of sockets are all in the closed state, it is determined that there is no communication event.

[0108] Here, the socket state can be an open state or a closed state. There can be multiple sockets between the protocol stack and the upper layer application. If multiple sockets are closed in a certain query, it can be considered that there is no communication event. If there is a socket in the open state among the multiple sockets, it can be considered that there is a communication event. Among them, the socket can specifically be a socket in the protocol data unit (PDU) adaptation layer.

[0109] In addition, the preset period may be, for example, 300ms, 400ms, 500ms, etc., which is not limited here.

[0110] In this way, by querying the multiple socket states between the protocol stack and the upper layer application, it is possible to accurately determine whether there is a communication event between the protocol stack and the upper layer application.

[0111] Based on this, in order to accurately determine whether there is a communication event between the protocol stack and the upper layer application, in some embodiments, the above-mentioned detection of whether there is a communication event between the protocol stack and the upper layer application may further include:

[0112] Querying socket states corresponding to multiple sockets between the protocol stack and the upper layer application according to a preset period;

[0113] Get the number of times the socket status is queried;

[0114] When the number of queries reaches a preset number of queries and there is an open state in the plurality of socket states, querying a storage module of the protocol stack;

[0115] In the case where the storage space in the storage module is full, it is determined that there is no communication event.

[0116] Here, the preset query number can be, for example, 90 times, 100 times, 110 times, etc., again without limitation. Within the preset query number, if multiple sockets are closed, it can be considered that there is no communication event. If the query number has reached the preset query number and there is a socket in the open state, the storage module of the protocol stack can continue to be queried. If the storage space in the storage module is not full, it can be considered that there is still a communication event. Because if the storage space is full and the communication between the protocol stack and the network card abstraction layer is closed, the protocol stack and the upper-layer application cannot actually communicate normally. Therefore, if the space in the storage module is full, it can be considered that there is no communication event.

[0117] In this way, by querying whether the storage space in the storage module is full, it is possible to accurately determine whether there is a communication event between the protocol stack and the upper layer application.

[0118] Figure 4 FIG. 1 is a flow chart showing a communication management method applied to a network management module provided in an embodiment of the present application. Figure 4 As shown, the communication management method provided in the embodiment of the present application includes the following steps:

[0119] S410, when the communication is in the on state, receiving link status information sent by the network card abstraction layer;

[0120] S420, generating a first instruction when the link status information indicates that the communication link is disconnected;

[0121] S430: Send a first instruction to the protocol stack, where the first instruction is used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer.

[0122] The communication management method of the embodiment of the present application can temporarily store data packets in the protocol stack by sending a first instruction to the protocol stack to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer when the communication link is disconnected, thereby reducing the loss of data packets and improving communication efficiency.

[0123] In some embodiments, the above S420 may specifically include:

[0124] When the link status information indicates that the communication link is disconnected, the communication start state is switched to the communication buffer state, and a first instruction is generated.

[0125] In addition, other steps of the method in the embodiment of the present application can be found above Figure 2 The relevant description of the illustrated embodiment will not be repeated here.

[0126] Based on this, in order to avoid the loss of data packets, in some embodiments, after the above S430, the following steps may be further included:

[0127] receiving a second instruction sent by the protocol stack, where the second instruction is generated by the protocol stack in the absence of a communication event;

[0128] In response to the second instruction, the communication buffer state is switched to the link activation waiting state.

[0129] In this way, by switching the network status management module from the communication buffer state to the link activation waiting state, it can be ensured that there is no data communication when the communication link is disconnected, thereby avoiding the loss of data packets.

[0130] Based on this, in order to ensure normal communication, in some embodiments, after the above S430, the following may also be included:

[0131] receiving a third instruction sent by the network card abstraction layer, where the third instruction is generated by the network card abstraction layer when the communication link is restored;

[0132] In response to the third instruction, the communication on state is entered.

[0133] Here, after the network management module sends the first instruction to the protocol stack, if the network card abstraction layer detects that the communication link is restored, it can send link status information indicating that the communication link is restored to the network status management module to enable the network management module to enter the communication start state.

[0134] As an example, if the communication link is restored during the period when the protocol stack detects whether there is a communication event between the protocol stack and the upper layer application, that is, during the period when the protocol stack is in the buffer state, the network management module can switch from the communication buffer state to the communication open state. After the network management module switches from the communication buffer state to the communication open state, the protocol stack can be notified to stop detecting whether there is a communication event between the protocol stack and the upper layer application, that is, the protocol stack can be notified to enter the open state from the buffer state.

[0135] As another example, if the communication link is restored when the protocol stack enters the shutdown state and the network state management module enters the waiting link activation state, the network management module can switch from the waiting link activation state to the communication start state. After the network management module switches from the waiting link activation state to the communication start state, the protocol stack can be notified to enter the start state from the shutdown state.

[0136] In this way, by entering the communication-on state when the communication link is restored, normal communication can be ensured.

[0137] Based on this, in some embodiments, after the above S430, the following may also be included:

[0138] receiving a fourth instruction sent by the communication module;

[0139] In response to the fourth instruction, a communication closed state is entered.

[0140] Here, if the communication module initiates a communication shutdown request when the communication link fails, the network status management module can first notify the network card abstraction layer to shut down the network card, then notify the protocol stack to shut down the protocol stack, and finally the network status management module enters the communication shutdown state.

[0141] It can be seen from the above embodiments that in the event of a communication link failure, the following three situations may occur: recovery after a brief link failure (i.e., the network status management module switches from the waiting link activation state or the communication buffer state to the communication enable state), failure to recover after a link failure (i.e., the network status management module switches from the communication enable state to the waiting link activation state), and receipt of a communication shutdown request after a link failure (i.e., the network status management module enters the communication shutdown state).

[0142] Based on this, in order to better describe the processing mechanisms for the above three different situations when the communication link is disconnected, some specific examples are given based on the above embodiments.

[0143] For example, based on the above three situations, the transition diagram between the six sub-states corresponding to the network state management module can be as follows: Figure 5 Specifically, if the link fails to recover, the state transition diagrams corresponding to the sockets in the network card abstraction layer, the network state management module, the network protocol stack, and the PDU adaptation layer can be as follows: Figure 6 If the link is restored after a short failure, the state transition diagrams corresponding to the sockets in the network card abstraction layer, network state management module, network protocol stack and PDU adaptation layer can be as follows: Figure 7 shown.

[0144] Based on the communication management method provided in the above embodiment, the present application also provides a specific implementation of the communication management device. Please refer to the following embodiment.

[0145] like Figure 8 As shown, the communication management device 800 provided in the embodiment of the present application includes the following modules:

[0146] A first receiving module 810, configured to receive a first instruction sent by the network status management module, where the first instruction is generated by the network status management module when the communication link is disconnected;

[0147] A first closing module 820, configured to close the communication between the protocol stack and the network card abstraction layer in response to the first instruction;

[0148] A detection module 830 is used to detect whether there is a communication event between the protocol stack and the upper layer application;

[0149] The second closing module 840 is used to close the protocol stack when there is no communication event.

[0150] The communication management device 800 is described in detail below, as follows:

[0151] In some embodiments, the detection module may specifically include:

[0152] A first query submodule, used for querying the socket states corresponding to the plurality of sockets between the protocol stack and the upper layer application according to a preset period;

[0153] The first determination submodule is used to determine that there is no communication event when the multiple socket states are all closed.

[0154] In some embodiments, the detection module may further include:

[0155] A second query submodule is used to query the socket states corresponding to the multiple sockets between the protocol stack and the upper layer application according to a preset period;

[0156] Get submodule, used to get the number of times the socket status is queried;

[0157] A third query submodule, configured to query a storage module of the protocol stack when the number of queries reaches a preset number of queries and an open state exists in the plurality of socket states;

[0158] The second determining submodule is used to determine that there is no communication event when the storage space of the storage module is full.

[0159] In some embodiments, the second closing module 840 may specifically include:

[0160] A first generating submodule, configured to generate a second instruction in the absence of a communication event;

[0161] A sending submodule, used for sending a second instruction to the network status management module, where the second instruction is used for instructing the network status management module to enter a link activation waiting state;

[0162] Close submodule for protocol stack.

[0163] In the communication management device of the embodiment of the present application, if the protocol stack still sends a data packet to the network card abstraction layer when the communication link is disconnected, the data packet will be lost. Therefore, by closing the communication between the protocol stack and the network card abstraction layer when the communication link is disconnected, the data packet in the protocol stack can be temporarily stored in the protocol stack, thereby reducing the loss of the data packet transmitted between the protocol stack and the network card abstraction layer. Since the communication between the protocol stack and the network card abstraction layer has been closed, if there is still a communication event between the protocol stack and the upper layer application, the data transmitted to the protocol stack by the upper layer application can be temporarily stored in the protocol stack. In this way, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, the loss of the data transmitted between the protocol stack and the upper layer application can be reduced. On the other hand, if there is no communication event between the protocol stack and the upper layer application and the protocol stack is still not closed, it will cause a waste of resources. Therefore, by closing the protocol stack when there is no communication event between the protocol stack and the upper layer application, the waste of resources can be reduced under the premise of reducing data loss. In this way, through the embodiment of the present application, data loss and resource waste can be reduced, and communication efficiency can be improved.

[0164] like Fig. 9 As shown, the communication management device 900 provided in the embodiment of the present application includes the following modules:

[0165] The second receiving module 910 is used to receive the link status information sent by the network card abstraction layer when the communication is in the on state;

[0166] A generating module 920, configured to generate a first instruction when the link status information indicates that the communication link is disconnected;

[0167] The sending module 930 is used to send a first instruction to the protocol stack, where the first instruction is used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer.

[0168] The communication management device 900 is described in detail below, as follows:

[0169] In some embodiments, the generating module 920 may specifically include:

[0170] The second generating submodule is used to switch from the communication start state to the communication buffer state and generate a first instruction when the link state information indicates that the communication link is disconnected.

[0171] In some embodiments, the communication management device 900 may further include:

[0172] A third receiving module, configured to receive a second instruction sent by the protocol stack after sending the first instruction to the protocol stack, where the second instruction is generated by the protocol stack in the absence of a communication event;

[0173] The switching module is used to switch from the communication buffer state to the link activation waiting state in response to the second instruction.

[0174] In some embodiments, the communication management device 900 may further include:

[0175] A fourth receiving module, configured to receive a third instruction sent by the network card abstraction layer after sending the first instruction to the protocol stack, where the third instruction is generated by the network card abstraction layer when the communication link is restored;

[0176] The entry module is used to enter the communication start state in response to the third instruction.

[0177] The communication management device of the embodiment of the present application can temporarily store data packets in the protocol stack by sending a first instruction to the protocol stack to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer when the communication link is disconnected, thereby reducing the loss of data packets and improving communication efficiency.

[0178] Based on the communication management method provided in the above embodiment, the embodiment of the present application also provides a specific implementation of the electronic device. Fig.10 A schematic diagram of an electronic device 1000 provided in an embodiment of the present application is shown.

[0179] The electronic device 1000 may include a processor 1010 and a memory 1020 storing computer program instructions.

[0180] Specifically, the processor 1010 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0181] The memory 1020 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1020 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 1020 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 1020 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 1020 is a non-volatile solid-state memory.

[0182] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present application.

[0183] The processor 1010 implements any one of the communication management methods in the above embodiments by reading and executing computer program instructions stored in the memory 1020 .

[0184] In one example, the electronic device 1000 may further include a communication interface 1030 and a bus 1040. Fig.10 As shown, the processor 1010, the memory 1020, and the communication interface 1030 are connected via a bus 1040 and communicate with each other.

[0185] The communication interface 1030 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0186] Bus 1040 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1040 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.

[0187] Exemplarily, the electronic device 1000 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).

[0188] The electronic device can execute the communication management method in the embodiment of the present application, thereby realizing the combination Figures 2 to 9 The communication management method and device described.

[0189] In addition, in combination with the communication management method in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the communication management methods in the above embodiment is implemented.

[0190] In addition, the embodiment of the present application further provides a vehicle, which may include at least one of the following:

[0191] A communication management device as in any one of the embodiments of the third aspect;

[0192] A communication management device as in any one of the embodiments of the fourth aspect;

[0193] An electronic device as in any one of the embodiments of the fifth aspect;

[0194] Such as the computer-readable storage medium in any embodiment of the sixth aspect. No further description will be given here.

[0195] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0196] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0197] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0198] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.

[0199] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A communication management method, characterized in that: include: receiving a first instruction sent by a network status management module, where the first instruction is generated by the network status management module when a communication link is disconnected; In response to the first instruction, closing the communication between the protocol stack and the network card abstraction layer; Detecting whether there is a communication event between the protocol stack and the upper layer application; In the absence of the communication event, the protocol stack is closed.

2. The method according to claim 1, characterized in that The detecting whether there is a communication event between the protocol stack and the upper layer application includes: querying socket states respectively corresponding to a plurality of sockets between the protocol stack and the upper layer application according to a preset period; When the plurality of socket states are all in the closed state, it is determined that the communication event does not exist.

3. The method according to claim 1, characterized in that: The detecting whether there is a communication event between the protocol stack and the upper layer application also includes: querying socket states respectively corresponding to a plurality of sockets between the protocol stack and the upper layer application according to a preset period; Get the number of times the socket status is queried; When the number of queries reaches a preset number of queries and there is an open state among the plurality of socket states, querying a storage module of the protocol stack; When the storage space of the storage module is full, it is determined that the communication event does not exist.

4. The method according to claim 1, characterized in that: In the absence of the communication event, closing the protocol stack includes: In the absence of the communication event, generating a second instruction; Sending the second instruction to the network status management module, where the second instruction is used to instruct the network status management module to enter a link activation waiting state; Shut down the protocol stack.

5. A communication management method, characterized in that: include: When the communication is in the on state, receiving the link status information sent by the network card abstraction layer; In a case where the link status information indicates that the communication link is disconnected, generating a first instruction; The first instruction is sent to the protocol stack, where the first instruction is used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer.

6. The method according to claim 5, characterized in that The generating a first instruction when the link status information indicates that the communication link is disconnected includes: When the link status information indicates that the communication link is disconnected, the communication start state is switched to the communication buffer state, and the first instruction is generated.

7. The method according to claim 6, characterized in that After sending the first instruction to the protocol stack, the method further includes: receiving a second instruction sent by the protocol stack, where the second instruction is generated by the protocol stack in the absence of a communication event; In response to the second instruction, the communication buffer state is switched to the link activation waiting state.

8. The method according to claim 6, characterized in that After sending the first instruction to the protocol stack, the method further includes: receiving a third instruction sent by the network card abstraction layer, wherein the third instruction is generated by the network card abstraction layer when the communication link is restored; In response to the third instruction, the communication on state is entered.

9. A communication management device, characterized in that: The device comprises: A first receiving module, configured to receive a first instruction sent by a network status management module, wherein the first instruction is generated by the network status management module when a communication link is disconnected; A first closing module, configured to close the communication between the protocol stack and the network card abstraction layer in response to the first instruction; A detection module, used to detect whether there is a communication event between the protocol stack and the upper layer application; The second closing module is used to close the protocol stack when the communication event does not exist.

10. A communication management device, characterized in that: The device comprises: A second receiving module is used to receive link status information sent by the network card abstraction layer when the communication is in the on state; A generating module, configured to generate a first instruction when the link status information indicates that the communication link is disconnected; The sending module is used to send the first instruction to the protocol stack, where the first instruction is used to instruct the protocol stack to close the communication between the protocol stack and the network card abstraction layer.

11. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the communication management method according to any one of claims 1 to 8 is implemented.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the communication management method according to any one of claims 1 to 8 is implemented.

13. A vehicle, characterized in that: Include at least one of the following: The communication management device as claimed in claim 9; The communication management device as claimed in claim 10; The electronic device as claimed in claim 11; The computer readable storage medium of claim 12.