A method and apparatus for communication between virtual devices, an electronic device, and a storage medium

By sending UDP packets directly at the transport layer, the problem of low communication efficiency between virtual devices is solved, enabling efficient communication and business processing.

CN118590558BActive Publication Date: 2026-07-10ZTE CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZTE CORP
Filing Date
2023-02-27
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

When using UDP communication between virtual devices on the same node, existing technologies suffer from redundant processing, resulting in low communication efficiency and reduced business efficiency.

Method used

When a UDP packet arrives at the transport layer of the OSI model, the transmission information is obtained, the virtual network device identifier is queried through a preset association relationship, and the UDP packet is directly sent to the corresponding virtual network device at the transport layer without going through the seven layers of encapsulation of the OSI model.

Benefits of technology

It improves communication and business efficiency between virtual devices, avoids redundant processing, and enhances communication quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118590558B_ABST
    Figure CN118590558B_ABST
Patent Text Reader

Abstract

The application relates to a virtual device intercommunication method and device, an electronic device and a storage medium. The method comprises the following steps: in the process that a first virtual device sends a user datagram protocol (UDP) packet to a second virtual device, when the UDP packet reaches a transport layer in an open system interconnection (OSI) model, obtaining transport information corresponding to the UDP packet; performing a query operation on a preset association relationship according to the transport information to obtain a query result; determining a first virtual network device corresponding to the first virtual device and a second virtual network device corresponding to the second virtual device according to the transport information; and sending the UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer according to the query result. When the two virtual devices transmit the UDP packet, the application cuts off the UDP packet at the transport layer, and does not need to encapsulate the UDP packet through seven layers of the OSI model, thereby improving communication efficiency and service efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information technology, and in particular to a communication method, apparatus, electronic device, and storage medium between virtual devices. Background Technology

[0002] With the current trend of cloudification in personal computers and servers, more and more businesses are using microservices to run on servers, with each microservice existing as a virtual device (such as a container or virtual machine). When virtual devices on the same node communicate using UDP (User Datagram Protocol), UDP packets are encapsulated sequentially through the application layer, presentation layer, session layer, transport layer, network layer, data link layer, and physical layer of the OSI (Open Systems Interconnection) model before being transmitted. For communication between virtual devices on the same node, processing UDP packets in this way is redundant, resulting in low communication efficiency and thus reducing business efficiency. Summary of the Invention

[0003] In view of this, in order to solve the above-mentioned technical problems or some of the technical problems, this application provides a communication method, apparatus, electronic device and storage medium between virtual devices.

[0004] In a first aspect, embodiments of the present invention provide a communication method between virtual devices, comprising:

[0005] During the process of the first virtual device sending a User Datagram Protocol (UDP) packet to the second virtual device, when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model, the transmission information corresponding to the UDP packet is obtained. The first virtual device and the second virtual device are set on the same electronic device.

[0006] Based on the transmitted information, a query operation is performed on the preset association relationship to obtain the query result;

[0007] Based on the transmission information, determine the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device;

[0008] Based on the query result, the UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0009] In an optional implementation, the step of sending the UDP packet to the second virtual device at the transport layer through the first virtual network device and the second virtual network device according to the query result includes:

[0010] When it is determined, based on the query result, that the UDP packet will be sent to the second virtual network device at the transport layer, the UDP packet is shallow copied to obtain the first target UDP packet;

[0011] The first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0012] In an optional implementation, the method further includes:

[0013] After obtaining the first target UDP packet, the first target UDP packet is encapsulated to obtain an encapsulated frame;

[0014] After obtaining the encapsulated frame, empty data packets are sent sequentially through the network layer and link layer of the OSI model to the physical layer of the OSI model.

[0015] The step of sending the first target UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer includes:

[0016] The encapsulated frame is decapsulated to obtain the first target UDP packet;

[0017] The first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0018] In an optional implementation, the transmission information includes a first identifier of a first virtual network device corresponding to the first virtual device and a second identifier of a second virtual network device corresponding to the second virtual device, and the preset association relationship stores multiple sets of correspondences between the two identifiers;

[0019] The step of performing a query operation on the preset association relationship based on the transmitted information to obtain the query result includes:

[0020] Based on the first identifier, a query operation is performed on the preset association relationship;

[0021] When the second identifier corresponding to the first identifier is stored in the preset association relationship, the first query result is obtained;

[0022] The step of sending the UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer according to the query result includes:

[0023] When the query result is the first query result, the UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0024] In an optional implementation, the method further includes:

[0025] After the first virtual device sends the UDP packet to the second virtual device at the transport layer, a first state corresponding to the first virtual network device and a second state corresponding to the second virtual network device are determined.

[0026] When the first state is a preset state, the correspondence related to the first identifier is released from the preset association relationship; and / or,

[0027] When the second state is the preset state, the correspondence related to the second identifier is released from the preset association relationship.

[0028] In an optional implementation, the method further includes:

[0029] When the second identifier corresponding to the first identifier is not stored in the preset association relationship, a second query result is obtained;

[0030] When the query result is the second query result, the UDP packet is processed sequentially through the transport layer, network layer, link layer and physical layer in the OSI model to obtain the second target UDP packet;

[0031] The second target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device.

[0032] In an optional implementation, the method further includes:

[0033] When the query result is the second query result, the preset association relationship is updated using the correspondence between the first identifier and the second identifier.

[0034] Secondly, this application provides a communication device between virtual devices, comprising:

[0035] The acquisition module is used to acquire the transmission information corresponding to the UDP packet when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model during the process of the first virtual device sending a User Datagram Protocol (UDP) packet to the second virtual device. The first virtual device and the second virtual device are set on the same electronic device.

[0036] The query module is used to perform a query operation on the preset association relationship based on the transmitted information to obtain the query result;

[0037] The determining module is configured to determine, based on the transmission information, the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device;

[0038] The sending module is configured to send the UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer, based on the query result.

[0039] Thirdly, this application provides an electronic device, including a processor and a memory, wherein the processor is configured to execute a virtual device communication program stored in the memory to implement the virtual device communication method described above.

[0040] Fourthly, this application provides a storage medium that stores one or more programs, which can be executed by one or more processors to implement the virtual device communication method described above.

[0041] This application provides a communication method between virtual devices. During the transmission of User Datagram Protocol (UDP) packets from a first virtual device to a second virtual device, when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model, the method obtains the corresponding transmission information for the UDP packet. The first and second virtual devices are located on the same electronic device. Based on the transmission information, a query operation is performed on a preset association relationship to obtain the query result. Based on the transmission information, the method determines the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device. Based on the query result, the UDP packet is sent to the second virtual device at the transport layer via the first and second virtual network devices. Through this method, during the UDP packet transmission between the two virtual devices, the UDP packet is truncated upon reaching the transport layer, enabling one virtual device to transmit the UDP packet to another at the transport layer without encapsulating the UDP packet through the seven layers of the OSI model, thus improving communication and service efficiency. Attached Figure Description

[0042] Figure 1 This is a schematic diagram of the communication structure between two virtual devices provided in this application;

[0043] Figure 2 A flowchart illustrating a communication method between virtual devices provided in this application;

[0044] Figure 3A flowchart illustrating another communication method between virtual devices provided in this application;

[0045] Figure 4 A schematic diagram of a communication device between virtual devices provided in this application;

[0046] Figure 5 A schematic diagram of the structure of an electronic device provided in this application;

[0047] In the attached diagrams above:

[0048] 101. First virtual device; 102. First virtual network device; 103. Second virtual device; 104. Second virtual network device;

[0049] 10. Acquisition Module; 20. Query Module; 30. Confirm Module; 40. Send Module;

[0050] 400. Electronic device; 401. Processor; 402. Memory; 4021. Operating system; 4022. Application program; 403. User interface; 404. Network interface; 405. Bus system. Detailed Implementation

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] To facilitate understanding of this application, the following will provide further explanation and description with reference to the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on this application.

[0053] refer to Figure 1 , Figure 1 This is a schematic diagram of the communication structure between two virtual devices provided in this application. The communication structure between the two virtual devices provided in this application includes: a first virtual device 101, a first virtual network device 102, a second virtual device 103, and a second virtual network device 104. The first virtual device 101 and the second virtual device 103 reside on the same node, which is an electronic device, and the electronic device can be a server. When the first virtual device 101 and the second virtual device 103 communicate via UDP, the first virtual device 101 encapsulates the UDP packet and sends the encapsulated UDP packet to the second virtual network device 104 via the first virtual network device 102. The second virtual network device 104 then sends the encapsulated UDP packet back to the second virtual device 102.

[0054] refer to Figure 2 , Figure 2 This application provides a flowchart illustrating a communication method between virtual devices. The communication method between virtual devices provided in this application includes the following steps:

[0055] S101: During the process of the first virtual device sending a User Datagram Protocol (UDP) packet to the second virtual device, when the UDP packet arrives at the transport layer in the Open Systems Interconnection (OSI) model, the transmission information corresponding to the UDP packet is obtained.

[0056] Specifically, this method is applied to the communication structure between the two virtual devices described above. The executing entity is an electronic device, on which both the first and second virtual devices are mounted. The first and second virtual devices communicate via UDP. To improve the communication efficiency between the first and second virtual devices, during the process of the first virtual device sending a UDP packet to the second virtual device, after the UDP packet is encapsulated through the application layer, presentation layer, and session layer of the OSI model and reaches the transport layer, the UDP packet is truncated at the transport layer to determine the transmission information carried by the UDP packet, thereby enabling the first virtual device to send the UDP packet to the second virtual device at the transport layer.

[0057] More specifically, both the first virtual device and the second virtual device are created by electronic devices. After the electronic devices create the first and second virtual devices, in order to enable communication between the virtual devices, a first virtual network device is created for the first virtual device and a second virtual network device is created for the second virtual device. Information about the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device is recorded. When the status or configuration information of the first virtual network device is updated, the correspondence between the first virtual devices is updated synchronously. Similarly, when the status or configuration information of the second virtual network device is updated, the correspondence between the second virtual devices is updated synchronously.

[0058] S102: Based on the transmitted information, perform a query operation on the preset association relationship to obtain the query result.

[0059] Specifically, the transmission information includes a first identifier of the first virtual network device corresponding to the first virtual device and a second identifier of the second virtual network device corresponding to the second virtual device. The first virtual device and the second virtual device need to communicate through their respective corresponding virtual network devices. The transmission information carried in the UDP packet can identify the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device. After encapsulating the UDP packet, the first virtual device can send it to the second virtual device through the first and second virtual network devices. More specifically, to enable the first virtual device to transmit UDP packets to the second virtual device at the transport layer, a pre-configured correspondence between the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device is established. After obtaining the transmission information, the correspondence is queried to check whether the transmission information is stored in the correspondence, and the UDP packet is transmitted according to the query result. The aforementioned correspondence is a pre-configured relationship between virtual network devices that support UDP packet transmission at the transport layer.

[0060] S103: Based on the transmission information, determine the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device.

[0061] Specifically, the electronic device pre-stores the correspondence between identifiers and virtual devices. In order to accurately transmit UDP packets to the second virtual device, the first virtual device determines the first virtual network device corresponding to the first identifier and the second virtual network device corresponding to the second identifier through the correspondence between identifiers and virtual devices.

[0062] S104: Based on the query results, the UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0063] Specifically, after obtaining the query results, the first virtual network device corresponding to the first virtual device, and the second virtual network device corresponding to the second virtual device, the first virtual device can send UDP packets to the second virtual device through the first virtual network device and the second virtual network device at the transport layer based on the query results.

[0064] This application provides a communication method between virtual devices. During the transmission of UDP packets between two virtual devices, the UDP packets are truncated after reaching the transport layer. This enables one virtual device to transmit UDP packets to another virtual device at the transport layer without encapsulating the UDP packets through the seven layers of the OSI model, thereby improving communication efficiency and business efficiency.

[0065] refer to Figure 3 , Figure 3A flowchart illustrating another communication method between virtual devices provided in this application. The communication method between virtual devices provided in this application includes the following steps:

[0066] S201: During the process of the first virtual device sending a User Datagram Protocol (UDP) packet to the second virtual device, when the UDP packet arrives at the transport layer in the Open Systems Interconnection (OSI) model, the transmission information corresponding to the UDP packet is obtained.

[0067] Step S201 is the same as step S101, and will not be repeated here in this embodiment. For details, please refer to the above description.

[0068] S202: Based on the transmitted information, perform a query operation on the preset association relationship to obtain the query result.

[0069] Specifically, the transmission information includes a first identifier of the first virtual network device corresponding to the first virtual device and a second identifier of the second virtual network device corresponding to the second virtual device. Multiple sets of correspondences between the two identifiers are stored in the preset association relationship. After obtaining the transmission information, if a correspondence between the transmission information is stored in the preset association relationship (i.e., the query result is the first query result), the condition for UDP packets to be transmitted at the transport layer is met; if no correspondence between the transmission information is stored in the preset association relationship (i.e., the query result is the second query result), the condition for UDP packets to be transmitted at the transport layer is not met. More specifically, step S202 includes:

[0070] Based on the first identifier, perform a query operation on the preset association relationship;

[0071] When the second identifier corresponding to the first identifier is stored in the preset association relationship, the first query result is obtained;

[0072] If the second identifier corresponding to the first identifier is not stored in the preset association relationship, the second query result is obtained.

[0073] S203: Based on the transmission information, determine the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device.

[0074] Step S203 is the same as step S103, and will not be repeated here. Please refer to the above description for details. It should be noted that regardless of whether the obtained query result is the first query result or the second query result, step S203 must be executed to determine the communication bridge (first virtual network device and second virtual network device) between the first virtual device and the second virtual device, so that UDP packets are sent to the second virtual device via the first virtual network device and the second virtual network device.

[0075] S204: When it is determined from the query result that the UDP packet will be sent to the second virtual network device at the transport layer, a shallow copy of the UDP packet is performed to obtain the first target UDP packet.

[0076] Specifically, determining to send a UDP packet to the second virtual network device at the transport layer based on the query result can be understood as the obtained query result being the first query result. When the query result is the first query result, the UDP packet can be sent to the second virtual device at the transport layer via the first and second virtual network devices. To further improve the communication efficiency between the first and second virtual devices, a shallow copy is performed on the UDP packet during transmission to send the obtained first target UDP packet to the second virtual device.

[0077] More specifically, when it is determined from the query results that the UDP packet will not be sent to the second virtual device at the transport layer (i.e., the obtained query result is the second query result), the UDP packet is processed sequentially through the transport layer, network layer, link layer and physical layer in the OSI model to obtain the second target UDP packet, and the second target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device.

[0078] The process of processing UDP packets sequentially through the transport, network, link, and physical layers of the OSI model can be understood as encapsulating the UDP packets according to the seven layers of the OSI model. After encapsulation, the encapsulated UDP packet (i.e., the second destination UDP packet) can be sent to the second virtual device to achieve communication between the first and second virtual devices. It should also be noted that, to facilitate subsequent communication between virtual devices, when the query result is the second query result, the pre-defined association relationship is updated using the correspondence between the first and second identifiers. In other words, the correspondence between the first and second identifiers is stored in the pre-defined association relationship, thereby updating the pre-defined association relationship.

[0079] S205: After obtaining the first target UDP packet, the first target UDP packet is encapsulated to obtain an encapsulated frame.

[0080] S206: After obtaining the encapsulated frame, send empty data packets to the physical layer of the OSI model sequentially through the network layer and link layer.

[0081] Specifically, regarding steps S205 and S206, when the query result is the first query result, if the first target UDP packet is directly sent to the second virtual network device at the transport layer, communication errors may occur during communication between the first and second virtual devices. To avoid errors during communication, after obtaining the first target UDP packet, it is encapsulated. After the network layer confirms that the first target UDP packet has been encapsulated at the transport layer, an empty data packet can be sent to the link layer, which then sends the empty data packet to the physical layer. This enables the simulated transmission of UDP packets. When encapsulating the first target UDP packet, the encapsulation header contains information about the second virtual network device, and the data end is the first target UDP packet.

[0082] S207: Decapsulate the encapsulated frame to obtain the first target UDP packet.

[0083] S208: At the transport layer, the first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device.

[0084] Specifically, regarding steps S207 and S208, since the encapsulated frame is formed by the relevant information of the second virtual network device and the first target UDP packet, decapsulating the encapsulated frame can obtain the relevant information of the receiving end (i.e., the second virtual network device) and the data to be transmitted at the transport layer (i.e., the first target UDP packet). After determining the second virtual network device and the first target UDP packet, the first target UDP packet can be sent to the second virtual device through the first virtual network device and the second virtual network device.

[0085] The communication method between virtual devices provided in this application, after the first virtual device sends a UDP packet to the second virtual device at the transport layer (that is, after the first virtual device sends a first target UDP packet to the second virtual device at the transport layer), further includes the following steps:

[0086] Determine the first state corresponding to the first virtual network device and the second state corresponding to the second virtual network device;

[0087] When the first state is a preset state, the correspondence related to the first identifier is released from the preset association relationship; and / or,

[0088] When the second state is the preset state, the correspondence related to the second identifier is released from the preset association relationship.

[0089] The preset states include a release state and a deactivation state. When the first state is the preset state, it indicates that the first virtual network device corresponding to the first identifier is no longer in use. Similarly, when the second state is the preset state, it indicates that the second virtual network device corresponding to the second identifier is no longer in use. When the first virtual network device and / or the second virtual network device are no longer in use, the corresponding relationship with its corresponding identifier must be released from the preset association relationship to reduce the query process when performing subsequent query operations on the preset association relationship.

[0090] This application provides a communication method between virtual devices. During the transmission of UDP packets between two virtual devices, the UDP packets are truncated after reaching the transport layer. This enables one virtual device to transmit UDP packets to another virtual device at the transport layer without encapsulating the UDP packets through the seven layers of the OSI model, thereby improving communication efficiency and business efficiency.

[0091] refer to Figure 4 , Figure 4 This application provides a schematic diagram of a communication device between virtual devices. The communication device between virtual devices includes: an acquisition module 10, a query module 20, a determination module 30, and a sending module 40. The acquisition module 10 is used to acquire transmission information corresponding to a User Datagram Protocol (UDP) packet when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model during the transmission of a UDP packet from a first virtual device to a second virtual device. The first virtual device and the second virtual device are located on the same electronic device. The query module 20 is used to perform a query operation on a preset association relationship based on the transmission information to obtain a query result. The determination module 30 is used to determine a first virtual network device corresponding to the first virtual device and a second virtual network device corresponding to the second virtual device based on the transmission information. The sending module 40 is used to send the UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer based on the query result.

[0092] Optionally, the sending module 40 is further configured to:

[0093] When it is determined, based on the query result, that the UDP packet will be sent to the second virtual network device at the transport layer, the UDP packet is shallow copied to obtain the first target UDP packet;

[0094] The first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0095] Optionally, the sending module 40 is further configured to:

[0096] After obtaining the first target UDP packet, the first target UDP packet is encapsulated to obtain an encapsulated frame;

[0097] After obtaining the encapsulated frame, empty data packets are sent sequentially through the network layer and link layer of the OSI model to the physical layer of the OSI model.

[0098] The encapsulated frame is decapsulated to obtain the first target UDP packet;

[0099] The first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0100] Optionally, the transmission information includes a first identifier of a first virtual network device corresponding to the first virtual device and a second identifier of a second virtual network device corresponding to the second virtual device, and the preset association relationship stores multiple sets of correspondences between the two identifiers.

[0101] Optionally, the query module 20 is also used for:

[0102] Based on the first identifier, a query operation is performed on the preset association relationship;

[0103] When the second identifier corresponding to the first identifier is stored in the preset association relationship, the first query result is obtained.

[0104] Optionally, the sending module 40 is also used for:

[0105] When the query result is the first query result, the UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0106] Optionally, the determining module 30 is also used for:

[0107] After the first virtual device sends the UDP packet to the second virtual device at the transport layer, a first state corresponding to the first virtual network device and a second state corresponding to the second virtual network device are determined.

[0108] This application provides a communication device between virtual devices, which further includes: a release module, the release module being used for:

[0109] When the first state is a preset state, the correspondence related to the first identifier is released from the preset association relationship; and / or,

[0110] When the second state is the preset state, the correspondence related to the second identifier is released from the preset association relationship.

[0111] Optionally, the query module 20 is also used for:

[0112] When the second identifier corresponding to the first identifier is not stored in the preset association relationship, a second query result is obtained.

[0113] Optionally, the sending module 40 is also used for:

[0114] When the query result is the second query result, the UDP packet is processed sequentially through the transport layer, network layer, link layer and physical layer in the OSI model to obtain the second target UDP packet;

[0115] The second target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device.

[0116] This application provides a communication device between virtual devices, which further includes: an update module, the update module being used for:

[0117] When the query result is the second query result, the preset association relationship is updated using the correspondence between the first identifier and the second identifier.

[0118] This application provides a communication device between virtual devices. During the transmission of UDP packets between two virtual devices, the UDP packets are truncated after reaching the transport layer, enabling one virtual device to transmit UDP packets to another virtual device at the transport layer without encapsulating the UDP packets through the seven layers of the OSI model, thus improving communication efficiency and service efficiency.

[0119] Figure 5 This application provides a schematic diagram of the structure of an electronic device. Figure 5 The illustrated electronic device 400 includes at least one processor 401, a memory 402, at least one network interface 404, and other user interfaces 403. The various components in the electronic device 400 are coupled together via a bus system 405. It is understood that the bus system 405 is used to implement communication between these components. In addition to a data bus, the bus system 405 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 5 The general designated all buses as Bus System 405.

[0120] The user interface 403 may include a display, keyboard, or clicking device (e.g., mouse, trackball, touchpad, or touchscreen).

[0121] It is understood that the memory 402 in this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 402 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0122] In some implementations, memory 402 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 4021 and application program 4022.

[0123] The operating system 4021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 4022 includes various applications, such as a media player and a browser, used to implement various application functions. Programs implementing the method of this application can be included in application program 4022.

[0124] In this application, by calling the program or instructions stored in memory 402, specifically the program or instructions stored in application program 4022, processor 401 is used to execute the method steps provided in each method embodiment, such as: during the process of a first virtual device sending a User Datagram Protocol (UDP) packet to a second virtual device, when the UDP packet arrives at the transport layer in the Open Systems Interconnection (OSI) model, obtaining the transmission information corresponding to the UDP packet, wherein the first virtual device and the second virtual device are located on the same electronic device; performing a query operation on a preset association relationship according to the transmission information to obtain a query result; determining the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device according to the transmission information; and sending the UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer according to the query result.

[0125] The methods disclosed in this application can be applied to or implemented by processor 401. Processor 401 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 401 or by instructions in software form. Processor 401 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor. The software units can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 402. Processor 401 reads the information in memory 402 and, in conjunction with its hardware, completes the steps of the above method.

[0126] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0127] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0128] The electronic device provided in this embodiment may be as follows: Figure 5 The electronic device shown can perform the following: Figure 2-3 All steps of the communication method between virtual devices in the middle, thereby realizing Figure 2-3 For details on the technical effects of the communication method between virtual devices shown, please refer to [link / reference]. Figure 2-3 The relevant descriptions are presented concisely and will not be elaborated upon here.

[0129] This application also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; it may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; and it may also include combinations of the above types of memory.

[0130] When one or more programs in the storage medium can be executed by one or more processors to implement the above-mentioned virtual device communication method executed on the communication device side between virtual devices.

[0131] The processor executes a virtual device communication program stored in memory to implement the following steps of a virtual device communication method executed on the communication device side: During the process of a first virtual device sending a User Datagram Protocol (UDP) packet to a second virtual device, when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model, the processor obtains the transmission information corresponding to the UDP packet, wherein the first virtual device and the second virtual device are located on the same electronic device; based on the transmission information, a query operation is performed on a preset association relationship to obtain a query result; based on the transmission information, a first virtual network device corresponding to the first virtual device and a second virtual network device corresponding to the second virtual device are determined; based on the query result, the UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

[0132] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0133] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0134] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above description is only a specific embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A communication method between virtual devices, characterized in that, include: During the process of the first virtual device sending a User Datagram Protocol (UDP) packet to the second virtual device, when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model, the transmission information corresponding to the UDP packet is obtained. The first virtual device and the second virtual device are set on the same electronic device. Based on the transmitted information, a query operation is performed on the preset association relationship to obtain the query result; Based on the transmission information, determine the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device; When it is determined, based on the query result, that the UDP packet will be sent to the second virtual network device at the transport layer, a first target UDP packet is obtained based on the UDP packet. After obtaining the first target UDP packet, the first target UDP packet is encapsulated to obtain an encapsulated frame; After obtaining the encapsulated frame, empty data packets are sent sequentially through the network layer and link layer of the OSI model to the physical layer of the OSI model. The encapsulated frame is decapsulated to obtain the first target UDP packet; The first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

2. The method according to claim 1, characterized in that, The step of obtaining the first target UDP packet based on the UDP packet includes: The UDP packet is shallow copied to obtain the first target UDP packet.

3. The method according to claim 1, characterized in that, The transmission information includes a first identifier of the first virtual network device corresponding to the first virtual device and a second identifier of the second virtual network device corresponding to the second virtual device. The preset association relationship stores multiple sets of correspondences between the two identifiers. The step of performing a query operation on the preset association relationship based on the transmitted information to obtain the query result includes: Based on the first identifier, a query operation is performed on the preset association relationship; When the second identifier corresponding to the first identifier is stored in the preset association relationship, the first query result is obtained; The step of sending the UDP packet to the second virtual device through the first virtual network device and the second virtual network device at the transport layer according to the query result includes: When the query result is the first query result, the UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

4. The method according to claim 3, characterized in that, The method further includes: After the first virtual device sends the UDP packet to the second virtual device at the transport layer, a first state corresponding to the first virtual network device and a second state corresponding to the second virtual network device are determined. When the first state is a preset state, the correspondence related to the first identifier is released from the preset association relationship; and / or, When the second state is the preset state, the correspondence related to the second identifier is released from the preset association relationship.

5. The method according to claim 3, characterized in that, The method further includes: When the second identifier corresponding to the first identifier is not stored in the preset association relationship, a second query result is obtained; When the query result is the second query result, the UDP packet is processed sequentially through the transport layer, network layer, link layer and physical layer in the OSI model to obtain the second target UDP packet; The second target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device.

6. The method according to claim 5, characterized in that, The method further includes: When the query result is the second query result, the preset association relationship is updated using the correspondence between the first identifier and the second identifier.

7. A communication device between virtual devices, characterized in that, include: The acquisition module is used to acquire the transmission information corresponding to the UDP packet when the UDP packet reaches the transport layer in the Open Systems Interconnection (OSI) model during the process of the first virtual device sending a User Datagram Protocol (UDP) packet to the second virtual device. The first virtual device and the second virtual device are set on the same electronic device. The query module is used to perform a query operation on the preset association relationship based on the transmitted information to obtain the query result; The determining module is configured to determine, based on the transmission information, the first virtual network device corresponding to the first virtual device and the second virtual network device corresponding to the second virtual device; The sending module is configured to obtain a first target UDP packet based on the UDP packet when it is determined, according to the query result, that the UDP packet will be sent to the second virtual network device at the transport layer; After obtaining the first target UDP packet, the first target UDP packet is encapsulated to obtain an encapsulated frame; After obtaining the encapsulated frame, empty data packets are sent sequentially through the network layer and link layer of the OSI model to the physical layer of the OSI model. The encapsulated frame is decapsulated to obtain the first target UDP packet; The first target UDP packet is sent to the second virtual device through the first virtual network device and the second virtual network device at the transport layer.

8. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute a virtual device communication program stored in the memory to implement the virtual device communication method according to any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the communication method between virtual devices according to any one of claims 1 to 6.