Multiplexing method, device, equipment and storage medium based on virtual serial port

By establishing a communication channel based on the virtual serial port on the cloud server and using a ring buffer to achieve multiplexing, the problem of poor communication flexibility between applications in the virtual machine is solved, and the flexibility and scalability of multi-application data interaction is improved.

CN115955444BActive Publication Date: 2025-01-17SANGFOR TECH INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211622500.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-16
Publication Date
2025-01-17
Estimated Expiration
2042-12-16

AI Technical Summary

Technical Problem

In the prior art, the virtual serial port has a single channel limitation as a communication channel, and cannot support many-to-many or one-to-many communication between applications in a virtual machine, resulting in poor flexibility and scalability.

Method used

By establishing a communication channel based on a virtual serial port on a cloud server, using a ring buffer to achieve data multiplexing, allowing data interaction between multiple client applications and server applications, realizing flexibility and scalability between multiple applications .

Benefits of technology

It improves the flexibility and scalability of data interaction between multiple applications, supports multiple applications to interact through the same communication channel, and enhances the duplication capability of the virtual serial port.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115955444B_ABST
    Figure CN115955444B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of virtual machine technology, and discloses a multiplexing method, device, equipment and storage medium based on a virtual serial port. The method receives communication data sent by a client application; the client application is connected to a first interactive system in communication; based on the circular buffer, each of the communication data is sent to the second interactive system through the communication channel, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is connected to the second interactive system in communication. The first interactive system and the second interactive system establish a communication channel based on a virtual serial port. Since the client application is connected to the first interactive system, the data communication of the server application connected to the second interactive system can be completed through the first interactive system based on the communication channel. Multiple applications realize multiplexing of the communication channel through the circular buffer, which improves the flexibility and scalability of data interaction between multiple applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtualization technology, and in particular to a multiplexing method, device, equipment and storage medium based on a virtual serial port. Background Art

[0002] Virtualization technology can create multiple virtual machines on a physical host, achieving resource isolation and effective utilization. Each virtual machine can run an operating system independently. The physical machine that runs the virtual machine is usually called the host machine.

[0003] If an application on a host machine, such as a cloud server, needs to communicate with an application in a virtual machine, the communication is usually performed through an IP network.

[0004] In the related art, if the IP network between the host machine and the virtual machine fails, or if communication via the IP network is not desired, a virtual serial port can be used to implement communication between the application of the host machine and the application of the virtual machine.

[0005] However, since the virtual serial port is a single channel and does not support repeated connections, if an application in the virtual machine connects to an application in the host machine through the virtual serial port, other applications in the virtual machine cannot use the virtual serial port to interact, and one-to-many or many-to-many communication between applications in the virtual machine cannot be achieved. Communication through the virtual serial port has poor flexibility and scalability. Summary of the invention

[0006] In order to overcome the problems existing in the related art, the present application provides a multiplexing method, device, equipment and storage medium based on a virtual serial port. In the multiplexing method, a client application is connected to a first interactive system, and a communication channel established based on the virtual serial port realizes data communication with a server application connected to a second interactive system, thereby realizing one-to-many or many-to-many communication between applications, thereby improving the flexibility and scalability of data interaction between applications.

[0007] A first aspect of the present invention provides a multiplexing method based on a virtual serial port, wherein a cloud server is deployed with a virtual machine, the virtual machine is deployed with a first interactive system, the cloud server is deployed with a second interactive system, the first interactive system and the second interactive system establish a communication channel based on the virtual serial port of the cloud server; the communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing; the method is applied to the first interactive system, and the method includes:

[0008] Receiving communication data sent by a plurality of client applications; each of the client applications is respectively connected to the first interactive system for communication;

[0009] Based on the ring buffer, each communication data is sent to the second interactive system through the communication channel, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is communicatively connected with the second interactive system.

[0010] In some embodiments, the cloud server is also deployed with a management platform, which is used to receive business deployment requests sent by users through the management interface of the management platform, and send the business deployment requests to the cloud server, so that the cloud server establishes the communication channel.

[0011] In some embodiments the method further comprises:

[0012] An application deployment request sent by a user through the management interface is received, and an application deployment task is generated and sent to the cloud server, so that the cloud server executes the application deployment task through the communication channel to perform application deployment.

[0013] In some embodiments, the cloud server is a platform server of a hyper-converged platform; then the receiving of communication data sent by multiple client applications includes:

[0014] receiving connection requests sent by a plurality of security management software client applications via a first communication protocol;

[0015] establishing a communication connection with the security management software client application according to the first communication protocol;

[0016] Receive communication data sent by the security management software client application through the communication connection.

[0017] In some embodiments, after receiving the connection request sent by the security management software client application through the first communication protocol, the communication method further includes:

[0018] A communication session with the second interactive system is established through the virtual serial port corresponding to the first interactive system; the communication session connection adopts a second communication protocol.

[0019] In some embodiments, sending each of the communication data to the second interactive system through the communication channel comprises:

[0020] Combining each of the communication data, the second communication protocol and the server port number into a serial port protocol packet;

[0021] The serial port protocol packet is sent to the second interactive system, so that after the second interactive system parses the serial port protocol packet, the communication data is sent to the security management software server application through the communication session according to the forwarding configuration rule, and the security management software server application is connected to the second interactive system of the platform server.

[0022] In some embodiments, the communication channel uses the KCP protocol for data transmission.

[0023] In a second aspect, the present application provides a multiplexing device based on a virtual serial port, wherein a cloud server is deployed with a virtual machine, the virtual machine is deployed with a first interactive system, the cloud server is deployed with a second interactive system, the first interactive system and the second interactive system establish a communication channel based on the virtual serial port of the cloud server; the communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing; the device is applied to the first interactive system, and the device includes:

[0024] A first receiving unit, configured to receive communication data sent by a plurality of client applications; each of the client applications is respectively connected to the first interactive system for communication;

[0025] The first communication unit is used to send each of the communication data to the second interactive system through the communication channel based on the ring buffer, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is communicatively connected with the second interactive system.

[0026] A third aspect of the present application provides a device, including:

[0027] Processor; and

[0028] A memory stores executable codes thereon, and when the executable codes are executed by the processor, the processor is caused to execute the method described above.

[0029] A fourth aspect of the present application provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor is caused to execute the method described above.

[0030] The technical solution provided by the present application is that the first interactive system and the second interactive system establish a communication channel based on a virtual serial port. Since the client application is connected to the first interactive system, the first interactive system can complete data communication with the server application connected to the second interactive system based on the communication channel. Multiple applications realize multiplexing of the communication channel through the circular buffer area, which improves the flexibility and scalability of data interaction between multiple applications.

[0031] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The above and other objects, features and advantages of the present application will become more apparent through a more detailed description of exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.

[0033] Figure 1 It is a flowchart of a multiplexing method based on a virtual serial port shown in an embodiment of the present application.

[0034] Figure 2 It is a structural diagram of using a ring buffer to read and write data provided by an embodiment of the present application.

[0035] Figure 3 It is a schematic diagram of a multi-application communication scenario shown in an embodiment of the present application.

[0036] Figure 4 It is a signaling interaction diagram of the EDR service shown in an embodiment of the present application.

[0037] Figure 5 This is another flowchart of multiplexing based on a virtual serial port shown in an embodiment of the present application.

[0038] Figure 6 Schematic diagram of network topology in a multi-virtual machine scenario shown in an embodiment of the present invention.

[0039] Figure 7 It is a structural schematic diagram of a multiplexing device based on a virtual serial port shown in an embodiment of the present application.

[0040] Figure 8 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The preferred embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0042] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0043] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0044] To facilitate understanding, the technical terms that may be used in this application are explained below.

[0045] Virtualization: Resource isolation and efficient resource utilization are achieved by creating multiple virtual machines on a physical host. Each virtual machine can run an operating system completely on its own. The real platform on which the virtual machine runs is called the host machine.

[0046] Virtual serial port: The virtualization layer software QEMU provides a channel for simulating serial port devices and exchanging data. What is presented inside the virtual machine is a serial port device, and what is presented on the host machine is a socket file. The virtual machine and the host machine exchange data by connecting to the virtualization layer module.

[0047] KCP: KCP is a UDP-based network transmission protocol (A Fast and Reliable ARQ Protocol).

[0048] Multiplexing: In data communication systems or computer network systems, the bandwidth or capacity of the transmission media often exceeds the requirement for transmitting a single signal. In order to effectively utilize communication lines, it is hoped that one channel can transmit multiple signals at the same time. This is the so-called multiplexing technology.

[0049] G2HProxy: The host and multiple virtual machines and multiple applications interactive system runs in the background of the hyper-converged platform. The name of the system service. vm means running on the virtual machine side, and host means running on the host side.

[0050] EDR: terminal security application, G2HProxy is used on the hyper-converged platform, which is the host and multiple virtual machines and multiple applications interactive system. edr_agt represents the client, edr_mgr represents the server, and G2HProxy is used to achieve mutual communication between virtual machines and hosts in a network-free scenario to monitor the security and health of virtual machines.

[0051] The present application can be applied in the field of virtual machine technology. In related technologies, a virtual serial port is used to interact between the application of the host machine and the application of the virtual machine. A single communication channel only supports a single application connection and does not support repeated connections. It is impossible to achieve multi-application and multi-communication, and the flexibility is poor.

[0052] In view of the above problems, an embodiment of the present application provides a multiplexing method based on a virtual serial port, which can realize simultaneous connection between multiple applications based on a single virtual serial port.

[0053] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0054] Figure 1 It is a flowchart of a multiplexing method based on a virtual serial port shown in an embodiment of the present application.

[0055] See also Figure 1 The present application provides a multiplexing method based on a virtual serial port, wherein a cloud server is deployed with a virtual machine, the virtual machine is deployed with a first interactive system, the cloud server is deployed with a second interactive system, the first interactive system and the second interactive system establish a communication channel based on the virtual serial port of the cloud server; the communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing; the method is applied to the first interactive system.

[0056] In the embodiment of the present application, the host machine may be a cloud server, and at least one virtual machine is deployed in the cloud service. The first interactive system may be deployed in the virtual machine, and the second interactive system may be deployed in the cloud server. The first interactive system and the second interactive system may be deployed in the form of software installation.

[0057] It is understandable that the virtual serial port corresponding to the first interactive system can be presented in the form of a serial port device in the virtual machine, and the first interactive system can be connected to the serial port device to achieve data interaction with the second interactive system deployed in the cloud server. The cloud server deploying the second interactive system usually registers and connects to the virtual serial port in the form of a socket.

[0058] In the embodiment of the present application, the first interactive system can establish a communication channel with the second interactive system based on the virtual serial port of the cloud service, and realize data transmission through the virtual serial port according to the communication channel.

[0059] It can be understood that in the embodiment of the present invention, the first interactive system and the second interactive system may have respective functional modules to implement related functions, such as an entry module, an exit module, and a serial port module.

[0060] It is understandable that the first interactive system can connect to the registered virtual serial port when the application is started or when the startup instruction of the first interactive system is received. In actual use, in the virtual machine, the process can be presented by connecting to the registered serial port device.

[0061] The multiplexing method in the embodiment of the present application is applied to a first interactive system of a virtual machine, and the method includes:

[0062] S10, receiving communication data sent by multiple client applications; each of the client applications is respectively connected to the first interactive system for communication.

[0063] In the embodiment of the present application, the client application can be connected to the first interactive system in communication. The client application can be connected in the form of a network protocol or a plug-in. For example, a network protocol such as TCP, UDP or other network communication protocols. Multiple client applications are connected to the first interactive system in communication respectively, and they are not directly connected to the server application through a virtual serial port.

[0064] It is understandable that the client system may be in the same virtual machine, or in other virtual machines or physical machines, as long as it can establish a communication connection with the first interactive system, and no limitation is made here.

[0065] In the embodiment of the present invention, the communication data may include a related identifier of a server application that needs to perform data interaction, so as to be able to interact with the server application.

[0066] In the embodiment of the present invention, there may be multiple client applications in the same virtual machine, which may be client applications of different types and functions. Of course, multiple client applications connected to the first interactive system may be in the same virtual machine, or in different virtual machines or other cloud servers or physical machines.

[0067] S20, sending each of the communication data to the second interactive system through the communication channel based on the ring buffer, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is communicatively connected with the second interactive system.

[0068] In the embodiment of the present application, the first interactive system can send communication data to the second interactive system through the communication channel to realize data transmission based on the serial port.

[0069] Similar to the communication data sent by the first interactive system to the second interactive system, the second interactive system can send communication data to the first interactive system in a similar manner. For example, the second interactive system can send the communication data to the server application according to the application identifier in the communication data to complete data transmission based on the virtual serial port.

[0070] Of course, it is understandable that the server application can return the response data to the second interactive system, and the second interactive system sends the response data to the first interactive system. After receiving the response data, the first interactive system forwards it to the client application to realize the communication connection between the client and the server.

[0071] In the embodiment of the present application, the communication channel established between the first interactive system and the second interactive system based on the virtual serial port may not consider the number of client applications, that is, the client application is connected to the first interactive system, rather than a single-channel direct connection, and the interaction process between the client application and the server application is realized through the data transmission and forwarding of the first interactive system.

[0072] It can be understood that in the embodiment of the present application, the number of client applications can be multiple, and multiple client applications can reuse the communication channel. When multiple client applications communicate through the channel, since a single virtual machine has only one virtual serial port, and the virtual serial port itself does not have the function of concurrency control, it is necessary to set the relevant functions of concurrency control.

[0073] In the embodiment of the present application, the concurrency control function can be implemented through an IO reuse model. In the IO reuse model, the virtual serial port corresponding to the virtual machine can store a paired circular buffer area, and the concurrency control of reading and writing data of the virtual serial port is implemented through the circular buffer area.

[0074] In the embodiment of the present application, the data in the communication channel can be transmitted using the KCP protocol, wherein the KCP protocol can ensure the reliability of the data and support the function of breakpoint resuming.

[0075] In the embodiment of the present application, the IO reuse model corresponds to a circular buffer area to realize reuse. The use of the circular buffer area can support multi-threaded safe reading and writing. The circular buffer data can pass the buffer area data to the virtual serial port in sequence. When the environment buffer area is full, wait for data to be output to the virtual serial port and then release the control to receive new data.

[0076] In actual use, data transmission can be achieved in the form of components. Multiple groups of data can be received through the circular buffer area from multiple outbound component coroutines. The circular buffer data will be sequentially transmitted to the virtual serial port. When the circular buffer is full, it will be blocked. After the data is waiting to be output to the serial port, the space will be released to receive new data. It supports multi-threaded safe reading and writing internally.

[0077] See also Figure 2 , Figure 2 It is a structural diagram of using a circular buffer to read and write data provided by an embodiment of the present application. In actual use, for example, a coroutine in an outbound component can write data to the circular buffer. If the circular buffer is full, the write operation of the current coroutine is blocked until there is a free buffer in the circular buffer. Or, the circular buffer is being locked by another coroutine, and the write operation of the current coroutine is blocked until the circular buffer is unlocked. For another example, the serial port read and write component takes out a data packet from the circular buffer. If there is no data in the circular buffer, the write thread of the serial port read and write component is blocked until there is data in the circular buffer that can be taken out. The serial port read and write component can also write the taken-out data packet into the serial port.

[0078] Therefore, the technical solution of the present application can achieve multiplexing of communication channels through a ring buffer.

[0079] In the technical solution of the present application, the cloud server is also deployed with a management platform, which is used to receive business deployment requests sent by users through the management interface of the management platform, and send the business deployment requests to the cloud server, so that the cloud server establishes the communication channel.

[0080] In some embodiments, the method further comprises:

[0081] An application deployment request sent by a user through the management interface is received, and an application deployment task is generated and sent to the cloud server, so that the cloud server executes the application deployment task through the communication channel to perform application deployment.

[0082] In the technical solution of the present application, the cloud server is also deployed with a management platform. The management platform can be provided with a management interface. Users such as software developers can deploy applications in virtual machines through the management interface.

[0083] It is understood that a button is provided in the management interface, and the deployment of the service is realized by clicking the button. The user can send a service deployment request to the management platform, and the management platform generates a service deployment task according to the service deployment request and sends it to the cloud server, such as the deployment of multiple applications, the deployment of the communication channel establishment process, etc.

[0084] In the technical solution of the present application, the communication data can be used to obtain relevant task data such as CPU utilization, memory usage, network status, etc.

[0085] It can be seen that in the technical solution provided by the present application, the first interactive system and the second interactive system establish a communication channel based on the virtual serial port, multiple client applications are communicatively connected with the first interactive system, and data interaction can be achieved based on the virtual serial port for the client application connected to the second interactive system. Multiplexing is achieved through a ring buffer during the interaction process, and a single application does not need to always occupy the communication channel of the virtual serial port, thereby improving the flexibility and scalability of multi-application data interaction.

[0086] See also Figure 3 , Figure 3 It is a schematic diagram of a multi-application communication scenario shown in an embodiment of the present application.

[0087] Among them, multiple application clients can be in the same virtual machine. The first interactive system 220 and the second interactive system 230 establish a communication channel 200 based on the virtual serial port. Based on this, the client application 211, the client application 212, and the client application 213 can all send communication data to the second interactive system 230 through the first interactive system 220 to realize the interaction with the server application 241, the server application 242, and the server application 243. The second interactive system 230 can realize the data forwarding between each client application and the corresponding server application according to its own configuration forwarding rules.

[0088] It can be seen that in the embodiment of the present application, the first interactive system and the second interactive system establish a communication channel based on the virtual serial port, and multiplexing of the communication channel is achieved through a ring buffer. Data interaction between multiple applications is achieved through the first interactive system and the second interactive system. Even if the virtual machine has multiple client applications that interact with the client application at the same time, data interaction can be carried out through the same communication channel, which improves the flexibility and scalability of multiple applications.

[0089] The embodiment of the present invention can be applied to the scenario of a hyper-converged platform. The cloud server can be a platform server of the hyper-converged platform. The embodiment of the present invention takes the EDR service as an example, see Figure 4 , Figure 4 It is a signaling interaction diagram of the EDR service shown in an embodiment of the present application.

[0090] In an embodiment of the present application, the EDR client edr_agt may have a security management software client application, the EDR server edr_mgr may have a security management software server application, the first interactive system is deployed in the virtual machine G2HProxy (vm) of the platform server, and the second interactive system is deployed in the platform server G2HProxy (host).

[0091] See also Figure 5 , Figure 5FIG. 1 is another flow chart of a multiplexing method based on a virtual serial port shown in an embodiment of the present application. The method may include:

[0092] S400: Receive a connection request sent by a security management software client application via a first communication protocol.

[0093] S401. Create a communication session with a second interactive system through a virtual serial port corresponding to the first interactive system; the communication session connection adopts a second communication protocol.

[0094] S402: Establish a communication connection with a security management software client application according to a first communication protocol.

[0095] S403: Receive communication data sent by the security management software client application through the communication connection.

[0096] S404, compose a serial port protocol packet with the communication data, the second communication protocol and the server port number.

[0097] S405. Send the serial port protocol packet to the second interactive system, so that the second interactive system parses the serial port protocol packet and sends the communication data to the security management software server application through the communication session according to the forwarding configuration rule. The security management software server application is connected to the second interactive system of the platform server in communication.

[0098] In the scenario of a hyper-converged platform, the first communication protocol may be a TCP protocol, and the full management software client application connects to the TCP port of the first interactive system through the TCP protocol, and can establish a communication connection with the TCP of the first interactive system, and receive communication data sent by the EDR client through the communication connection.

[0099] In step 401, after receiving the connection request, a session of a second communication protocol such as KCP can be established with the second interactive system. The KCP session can send relevant session data to the second interactive system through the virtual serial port.

[0100] In order to forward the communication data sent by the security management software client to the security management software server, the first interactive system can encapsulate the communication data, communication protocol and server port number into a serial port protocol packet and send it to the second interactive system through the virtual serial port.

[0101] In step 405, the second interactive system can parse the serial port protocol packet, and use the dial-up method to the server port number according to the forwarding configuration rules to establish a TCP connection with the security management software server, and send the communication data to the security management software server application through the TCP connection.

[0102] It can be understood that KCP is a fast and reliable protocol based on UDP. The embodiment of the present application replaces the underlying UDP protocol as the port address access function through a customized virtual serial port protocol to achieve reliability guarantees such as data loss and retransmission during the serial port transmission process.

[0103] KCP reliable transmission is achieved through the following mechanisms:

[0104] ACK mechanism: after the sender sends the data, it waits for the confirmation response from the other end.

[0105] The retransmission mechanism is that after the sender sends data, if it does not receive an ACK from the other end, it continues to resend the data.

[0106] Sequence number mechanism: the sequence number is included in both the data sending packet and the response packet to ensure the order of data packet transmission.

[0107] The reordering mechanism uses the sequence number mechanism to sort and reorganize the data segments.

[0108] The window mechanism is mainly used for flow control and congestion control.

[0109] In actual use, the virtual machine address set by the protocol and the application identifier, such as the virtual port address, are matched. If the destination is the host, the corresponding virtual machine address is 0. Different addresses and virtual application ports are used to identify different sessions and pass them to different peer application connection processing.

[0110] In actual use, the specific content of the protocol header of the protocol used in the communication channel in the embodiment of the present application can be seen in Table 1 below.

[0111] Table 1

[0112]

[0113] It can be seen that the embodiment of the present application enhances the scalability of the hyper-converged platform through the virtual serial port, thereby enhancing the subsequent application access capability of the hyper-converged platform system. In the future, the hyper-converged development open ecosystem will connect with other products to provide access and traffic forwarding support.

[0114] The above embodiment introduces the main process in which the first interactive system on the virtual machine side is the execution subject. The following is a detailed introduction taking the second interactive system in the cloud server as the execution subject.

[0115] The present application discloses a multiplexing method based on a virtual serial port. A cloud server is deployed with a virtual machine, the virtual machine is deployed with a first interactive system, the cloud server is deployed with a second interactive system, the first interactive system and the second interactive system establish a communication channel based on the virtual serial port of the cloud server; the communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing; the method is applied to the first interactive system; the method is applied to the second interactive system, and the method includes:

[0116] S500: Receive communication data sent by the first interactive system through a communication channel.

[0117] S501. Determine a server application according to a parsing result of communication data; the server application is communicatively connected with a second interactive system.

[0118] S502: Send the communication data to the server application.

[0119] In the embodiment of the present application, when the first interactive system is started, it can establish a communication channel with the second interactive system in the virtual machine by detecting and connecting the socket file of the virtual serial port.

[0120] It is understandable that if there are multiple virtual machines, since the first interactive system and the second interactive system are deployed in the embodiment of the present application, when the socket file corresponding to each virtual machine is registered, it will be recorded in the monitoring table. By managing the monitoring table, batch management of virtual serial ports can be achieved.

[0121] It is understandable that after the socket file is registered, it can be presented in the form of a serial port device in the corresponding virtual machine, and communication with the cloud server can be achieved by connecting the serial port device.

[0122] See also Figure 6 , Figure 6 6 is a schematic diagram of a network topology in a multi-virtual machine scenario according to an embodiment of the present invention, wherein the first interactive system 611 of each virtual machine 610 can interact with the second interactive system 601 of the cloud server 600 through the corresponding virtual serial port 612 .

[0123] In some embodiments, there are multiple virtual machines deployed with the first interactive system, and the communication method further includes:

[0124] When the start-up instruction of the second interactive system is received, the address information of the virtual machine for which the communication channel needs to be established is determined according to the monitoring table.

[0125] A communication channel with each first interactive system is established according to the information; and the communication channel performs data exchange based on the virtual serial ports of the first interactive systems respectively corresponding to the communication channels.

[0126] When any communication channel is abnormal, the relevant information of the communication channel is deregistered in the monitoring table.

[0127] In the embodiment of the present application, when the second interactive system is started, it is possible to monitor whether the virtual serial port is connected according to the monitoring table. When a single virtual serial port is abnormal or closed, the monitoring of the virtual serial port is achieved by canceling the relevant content in the monitoring table. It is also possible to independently traverse the virtual serial port device at a fixed time, and if it is found that it is not registered, it can be automatically reconnected. In actual use, the sock_srteam method can be used for monitoring, and the socket connection can be made through the DialUnix domain.

[0128] In the embodiment of the present application, the cloud server can simultaneously establish multiple communication channels with the first interactive system deployed in multiple virtual machines through the second interactive system, and each communication channel can simultaneously support connection sessions of multiple applications.

[0129] In the embodiment of the present application, in the hyper-converged platform scenario, receiving communication data sent by the client application includes:

[0130] A connection request sent by a security management software client application via a first communication protocol is received.

[0131] A communication connection is established with a security management software client application according to a first communication protocol.

[0132] Receive communication data sent by the security management software client application through the communication connection.

[0133] After receiving a connection request sent by the security management software client application through the first communication protocol, the communication method also includes: creating a communication session with the second interactive system through the virtual serial port corresponding to the first interactive system; the communication session connection adopts the second communication protocol.

[0134] At least sending the communication data to the second interactive system through the communication channel includes: forming a serial port protocol packet with the communication data, the second communication protocol and the server port number. The serial port protocol packet is sent to the second interactive system, so that the second interactive system parses the serial port protocol packet and sends the communication data to the security management software server application through the communication session according to the forwarding configuration rule, and the security management software server application is connected to the second interactive system of the platform server.

[0135] In the embodiment of the present application, the second interactive system can forward the received communication data through the set forwarding configuration rules. Various forwarding rules and configuration rules can be set in the forwarding configuration rules. For example, the port number and communication protocol type in the received communication data can be used to determine how to connect to the server application server, and it can be set to forward it to the set port.

[0136] In the embodiments of the present application, multiplexing and multi-application communication in a hyper-converged platform scenario can be expanded.

[0137] In actual use, the implementation process of each method in the above embodiments can be implemented in the form of functional modules, and the first interactive system and the second interactive system can both include their own functional modules such as serial port modules, entry modules and exit modules. Among them, when the serial port module is loaded, the detection of the virtual serial port can be turned on. When the entry module is loaded, the network protocol entry module, the virtual serial port monitoring module and the entry plug-in can be loaded. When the exit module is loaded, the network protocol exit module, the virtual serial port forwarding module and the exit plug-in can be loaded. It can be understood that the process of loading each module can be executed when the first interactive system or the second interactive system receives a startup instruction. The startup instruction can be generated when the client application is started, or it can be generated when the first interactive system or the second interactive system needs to be started, and it is not limited here.

[0138] Through the above embodiments, the beneficial effects that can be achieved by the present application include at least: being able to support mutual data forwarding of multiple applications in the absence of a network, being able to fully utilize the performance of virtual serial ports and realize multiplexing of virtual serial ports, being able to batch deploy virtual serial ports of each virtual machine in a cloud server, and being able to enhance the scalability of a hyper-converged platform.

[0139] Corresponding to the aforementioned application function implementation method embodiment, the present application also provides a communication device based on a virtual serial port, an electronic device and corresponding embodiments.

[0140] Figure 7 It is a structural schematic diagram of a multiplexing device based on a virtual serial port shown in an embodiment of the present application.

[0141] 9. See Figure 7 The present application provides a multiplexing device based on a virtual serial port. A first interactive system is deployed on a virtual machine of a cloud server, and a second interactive system is deployed on the cloud server. A communication channel is established between the first interactive system and the second interactive system based on the virtual serial port of the cloud server. The communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing. The device is applied to the first interactive system, and the device includes:

[0142] A first receiving unit 1, used to receive communication data sent by a plurality of client applications; each of the client applications is respectively connected to the first interactive system for communication;

[0143] The first communication unit 2 is used to send each of the communication data to the second interactive system through the communication channel based on the ring buffer, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is communicatively connected with the second interactive system.

[0144] In some embodiments, each of the plurality of client applications is connected to the first interactive system via a network protocol or a plug-in.

[0145] In some embodiments, the cloud server is a platform server of a hyper-converged platform; then receiving the communication data sent by the client application includes:

[0146] Receiving a connection request sent by a security management software client application via a first communication protocol;

[0147] establishing a communication connection with the security management software client application according to the first communication protocol;

[0148] Receive communication data sent by the security management software client application through the communication connection.

[0149] In some embodiments, after receiving the connection request sent by the security management software client application through the first communication protocol, the communication method further includes:

[0150] A communication session with the second interactive system is established through the virtual serial port corresponding to the first interactive system; the communication session connection adopts a second communication protocol.

[0151] In some embodiments, sending at least the communication data to the second interactive system through the communication channel comprises:

[0152] Combining the communication data, the second communication protocol and the server port number into a serial port protocol packet;

[0153] The serial port protocol packet is sent to the second interactive system, so that after the second interactive system parses the serial port protocol packet, the communication data is sent to the security management software server application through the communication session according to the forwarding configuration rule, and the security management software server application is connected to the second interactive system of the platform server.

[0154] In some embodiments, the communication channel uses the KCP protocol for data transmission.

[0155] The embodiment of the present application provides a multiplexing device based on a virtual serial port, wherein a first interactive system is deployed on a virtual machine of a cloud server, and a second interactive system is deployed on the cloud server, wherein a communication channel is established between the first interactive system and the second interactive system based on the virtual serial port of the cloud server; the communication channel uses a ring buffer to read and write virtual serial port data to realize multiplexing, and the device comprises:

[0156] A second receiving unit, configured to receive communication data sent by the first interactive system through the communication channel;

[0157] A parsing unit, configured to determine a server application according to a parsing result of the communication data; the server application is communicatively connected with the second interactive system;

[0158] The second communication unit 5 is used to send the communication data to the server application.

[0159] In some embodiments, there are multiple virtual machines deployed with the first interactive system, and the communication method further includes:

[0160] When receiving the start instruction of the second interactive system, determining the address information of the virtual machine for which the communication channel needs to be established according to the monitoring table;

[0161] A communication channel with each first interactive system is established according to the address information; and the communication channel performs data exchange based on the virtual serial port of the first interactive system corresponding to each other.

[0162] In some embodiments, it is also used to: when any communication channel is abnormal, the relevant information of the communication channel is deregistered from the monitoring table.

[0163] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated again here.

[0164] The present application provides a multiplexing device based on a virtual serial port. A first interactive system and a second interactive system establish a communication channel based on the virtual serial port. Since the client application is connected to the first interactive system, data communication with a server application connected to the second interactive system can be completed through the first interactive system based on the communication channel. Multiple applications implement multiplexing of the communication channel through a circular buffer area, thereby improving the flexibility and scalability of data interaction between multiple applications. Data interaction can also be performed through the communication channel, thereby improving the flexibility and scalability of multiple applications.

[0165] Figure 8 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application.

[0166] See also Figure 8 , the electronic device 1000 includes a memory 1010 and a processor 1020 .

[0167] The processor 1020 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0168] The memory 1010 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. Among them, ROM can store static data or instructions required by the processor 1020 or other modules of the computer. The permanent storage device may be a readable and writable storage device. The permanent storage device may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In some other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at run time. In addition, the memory 1010 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 1010 may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (such as a DVD-ROM, a double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (such as an SD card, a mini SD card, a Micro-SD card, etc.), a magnetic floppy disk, etc. The computer-readable storage medium does not include carrier waves and transient electronic signals transmitted wirelessly or wired.

[0169] The memory 1010 stores executable codes, and when the executable codes are processed by the processor 1020 , the processor 1020 can execute part or all of the methods described above.

[0170] The scheme of the present application has been described in detail above with reference to the accompanying drawings. In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, refer to the relevant description of other embodiments. Those skilled in the art should also know that the actions and modules involved in the description are not necessarily required for the present application. In addition, it can be understood that the steps in the method of the embodiment of the present application can be adjusted in order, merged and deleted according to actual needs, and the modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0171] In addition, the method according to the present application may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing some or all of the steps in the above method of the present application.

[0172] Alternatively, the present application can also be implemented as a non-temporary machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) on which executable code (or computer program, or computer instruction code) is stored. When the executable code (or computer program, or computer instruction code) is executed by a processor of an electronic device (or electronic device, server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present application.

[0173] Those skilled in the art will further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the application herein may be implemented as electronic hardware, computer software, or combinations of both.

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

[0175] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A multiplexing method based on a virtual serial port, characterized in that: The cloud server is deployed with a virtual machine, the virtual machine is deployed with a first interactive system, the cloud server is deployed with a second interactive system, and a communication channel is established between the first interactive system and the second interactive system based on a virtual serial port of the cloud server; The communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing; The method is applied to a first interactive system, and the method includes: Receiving communication data sent by a plurality of client applications; each of the client applications is respectively connected to the first interactive system for communication; Based on the ring buffer, each communication data is sent to the second interactive system through the communication channel, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is communicatively connected with the second interactive system.

2. The method according to claim 1, characterized in that The cloud server is also deployed with a management platform, which is used to receive a business deployment request sent by a user through a management interface of the management platform, and send the business deployment request to the cloud server, so that the cloud server establishes the communication channel.

3. The method according to claim 2, characterized in that The method further comprises: An application deployment request sent by a user through the management interface is received, and an application deployment task is generated and sent to the cloud server, so that the cloud server executes the application deployment task through the communication channel to perform application deployment.

4. The method according to claim 1, characterized in that: The cloud server is a platform server of a hyper-converged platform; then the receiving of communication data sent by multiple client applications includes: receiving connection requests sent by a plurality of security management software client applications via a first communication protocol; establishing a communication connection with the security management software client application according to the first communication protocol; Receive communication data sent by the security management software client application through the communication connection.

5. The method according to claim 4, characterized in that After receiving the connection request sent by the security management software client application through the first communication protocol, the communication method further includes: A communication session with the second interactive system is established through the virtual serial port corresponding to the first interactive system; the communication session connection adopts a second communication protocol.

6. The method according to claim 5, characterized in that: The sending each of the communication data to the second interactive system through the communication channel comprises: Combining each of the communication data, the second communication protocol and the server port number into a serial port protocol packet; The serial port protocol packet is sent to the second interactive system, so that after the second interactive system parses the serial port protocol packet, the communication data is sent to the security management software server application through the communication session according to the forwarding configuration rule, and the security management software server application is connected to the second interactive system of the platform server.

7. The method according to claim 1, characterized in that The communication channel uses the KCP protocol for data transmission.

8. A multiplexing device based on a virtual serial port, characterized in that: The cloud server is deployed with a virtual machine, the virtual machine is deployed with a first interactive system, the cloud server is deployed with a second interactive system, and a communication channel is established between the first interactive system and the second interactive system based on a virtual serial port of the cloud server; The communication channel uses a ring buffer to read and write virtual serial port data to achieve multiplexing; The device is applied to the first interactive system, and the device includes: A first receiving unit, configured to receive communication data sent by a plurality of client applications; each of the client applications is respectively connected to the first interactive system for communication; The first communication unit is used to send each of the communication data to the second interactive system through the communication channel based on the ring buffer, so that the second interactive system sends the communication data to the server application according to the identifier of the server application in the communication data; the server application is communicatively connected with the second interactive system.

9. A device, characterized in that: include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 7.

10. A non-transitory machine-readable storage medium having executable codes stored thereon, which, when executed by a processor of an electronic device, causes the processor to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data packet transmission system and method

    CN107370742A

  • Data packet transmission system and method

    CN107395606A