Communication method and system for virtual machine and local terminal
Through the connection between virtual machines and transit servers and QR code technology, the problem of closedness of cloud desktop protocols is solved, direct communication between virtual machines and terminals is realized, new communication methods are provided, and the limitations of existing protocols are broken.
Patent Information
- Application Number
- CN202411165161.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-24
AI Technical Summary
The existing cloud desktop protocol is closed and proprietary, limiting the direct communication capability between the virtual machine and the local terminal, and cannot support external applications to directly access the virtual machine internal resources.
Establish a connection with the relay server through a virtual machine, generate a QR code containing connection information, and recognize and parse the QR code at the terminal to establish a connection request. The relay server assists in the communication connection between the virtual machine and the terminal, realizing that it does not rely on cloud desktop protocol communication.
Without relying on the cloud desktop protocol, communication between the virtual machine and the local terminal is realized, breaking the closed limitations of the existing protocol and providing a new communication method.
Smart Images

Figure CN119182769A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication method and system between a virtual machine and a local terminal. Background Art
[0002] As a key application of cloud computing, cloud desktop uses virtualization technology to create multiple independent virtual machines on the data center server. Each virtual machine is equipped with dedicated CPU and memory resources. Users use different virtual machines to effectively avoid resource competition and conflicts. This architecture not only improves the utilization efficiency of computing resources, but also greatly simplifies IT resource management and deployment.
[0003] In a cloud desktop environment, the key to communication between virtual machines and user terminals lies in cloud desktop protocols. These protocols are responsible for transmitting the display content in the virtual machine to the local terminal and feeding back the user's operations on the local terminal to the virtual machine, thereby achieving remote control and operation. However, existing cloud desktop protocols have significant limitations, mainly reflected in their closed and proprietary nature. Virtual machines can only be connected and accessed through protocol clients, and external applications are not supported to directly access resources inside the virtual machine, thus limiting the direct communication capabilities between other applications on the terminal and the virtual machine. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a communication method and system between a virtual machine and a local terminal, which can realize the communication between the local terminal and the cloud desktop virtual machine without relying on the cloud desktop protocol.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is: a communication method between a virtual machine and a local terminal, comprising:
[0006] After the virtual machine establishes a connection with the transit server, a connection QR code is generated according to the connection information, and the connection QR code is displayed on the virtual machine desktop, wherein the connection information includes a unique identifier of the virtual machine and an Internet Protocol address of the transit server;
[0007] The terminal identifies and parses the connection QR code to obtain the connection information;
[0008] The terminal establishes a connection with the transit server according to the connection information, and sends a connection request to the transit server, wherein the connection request includes a unique identifier of the virtual machine;
[0009] After receiving the connection request, the transit server associates the terminal with the virtual machine to implement communication between the terminal and the virtual machine.
[0010] The present invention also proposes a communication system between a cloud desktop and a local terminal, comprising a virtual machine, a terminal and a transfer server;
[0011] After the virtual machine is used to establish a connection with the transit server, a connection QR code is generated according to the connection information, and the connection QR code is displayed on the virtual machine desktop, wherein the connection information includes a unique identifier of the virtual machine and an Internet protocol address of the transit server;
[0012] The terminal is used to identify and parse the connection QR code to obtain the connection information; establish a connection with the transit server according to the connection information, and send a connection request to the transit server, wherein the connection request includes a unique identifier of the virtual machine;
[0013] The transfer server is used to associate the terminal with the virtual machine after receiving the connection request, so as to realize communication between the terminal and the virtual machine.
[0014] The beneficial effects of the present invention are as follows: by setting a relay server as a relay, the virtual machine first establishes a connection with the relay server, and generates a QR code containing the information required for the connection and displays it on its desktop. The terminal establishes a connection with the relay server by identifying the QR code, and sends a request to the relay server to establish a connection with the virtual machine. The relay server assists in establishing a communication connection between the terminal and the virtual machine, thereby realizing communication between the local terminal and the cloud desktop virtual machine without relying on the cloud desktop protocol. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A flow chart of a communication method between a virtual machine and a local terminal of the present invention;
[0016] Figure 2 This is a schematic diagram of the architecture of a communication system between a virtual machine and a local terminal according to a first embodiment of the present invention;
[0017] Figure 3 This is a flow chart of a method according to Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0018] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is a detailed description in conjunction with the implementation methods and the accompanying drawings.
[0019] See also Figure 1 , a communication method between a virtual machine and a local terminal, comprising:
[0020] After the virtual machine establishes a connection with the transit server, a connection QR code is generated according to the connection information, and the connection QR code is displayed on the virtual machine desktop, wherein the connection information includes a unique identifier of the virtual machine and an Internet Protocol address of the transit server;
[0021] The terminal identifies and parses the connection QR code to obtain the connection information;
[0022] The terminal establishes a connection with the transit server according to the connection information, and sends a connection request to the transit server, wherein the connection request includes a unique identifier of the virtual machine;
[0023] After receiving the connection request, the transit server associates the terminal with the virtual machine to implement communication between the terminal and the virtual machine.
[0024] From the above description, it can be seen that the beneficial effect of the present invention is that communication between a local terminal and a cloud desktop virtual machine can be achieved without relying on a cloud desktop protocol.
[0025] Furthermore, after the virtual machine establishes a connection with the transit server, a connection QR code is generated according to the connection information, including:
[0026] The virtual machine sends a first registration request to the relay server, the first registration request includes a unique identifier of the virtual machine, and receives first response information returned by the relay server, the first response information includes a first registration result and an Internet Protocol address of the relay server;
[0027] If the first registration result is successful registration, the virtual machine generates a connection QR code according to the connection information.
[0028] As can be seen from the above description, once the registration is completed, the connection between the virtual machine and the transit server is established.
[0029] Furthermore, the connection QR code is displayed on the virtual machine desktop, specifically:
[0030] The connection QR code is displayed on the top layer of the virtual machine desktop.
[0031] Furthermore, the terminal identifies and parses the connection QR code to obtain the connection information, including:
[0032] The terminal captures the virtual machine desktop image according to a preset period, and performs QR code recognition on the virtual machine desktop image to determine whether the connection QR code is recognized;
[0033] If so, the connection QR code is parsed to obtain the connection information.
[0034] It can be seen from the above description that by displaying the QR code on the top layer and identifying it through screenshot, the terminal can easily identify the QR code.
[0035] Further, the terminal establishes a connection with the transit server according to the connection information, and sends a connection request to the transit server, including:
[0036] The terminal sends a second registration request to the relay server according to the Internet Protocol address of the relay server in the connection information, wherein the second registration request includes the unique identifier of the terminal, and receives second response information returned by the relay server, wherein the second response information includes a second registration result;
[0037] If the second registration result is successful registration, the terminal sends a connection request to the transit server, where the connection request includes the unique identifier of the virtual machine.
[0038] As can be seen from the above description, the completion of registration means that the connection between the terminal and the transit server is established.
[0039] Further, the connection information further includes an Internet Protocol address of the virtual machine, and the second registration request further includes an Internet Protocol address of the terminal;
[0040] The implementation of communication between the terminal and the virtual machine is specifically as follows:
[0041] The transit server sends the Internet Protocol address of the terminal to the virtual machine, so that the virtual machine and the terminal establish a communication connection.
[0042] It can be seen from the above description that by enabling both the virtual machine and the terminal to have the necessary connection information of the other party, a direct communication connection can be established between the terminal and the virtual machine.
[0043] Further, the communication between the terminal and the virtual machine is implemented by:
[0044] The terminal and the virtual machine communicate through the transit server.
[0045] It can be seen from the above description that data forwarding between the terminal and the virtual machine is achieved through the transit server.
[0046] The present invention also proposes a communication system between a cloud desktop and a local terminal, comprising a virtual machine, a terminal and a transfer server;
[0047] After the virtual machine is used to establish a connection with the transit server, a connection QR code is generated according to the connection information, and the connection QR code is displayed on the virtual machine desktop, wherein the connection information includes a unique identifier of the virtual machine and an Internet protocol address of the transit server;
[0048] The terminal is used to identify and parse the connection QR code to obtain the connection information; establish a connection with the transit server according to the connection information, and send a connection request to the transit server, wherein the connection request includes a unique identifier of the virtual machine;
[0049] The transfer server is used to associate the terminal with the virtual machine after receiving the connection request, so as to realize communication between the terminal and the virtual machine.
[0050] Embodiment 1
[0051] Please refer to Figure 2-3 , Embodiment 1 of the present invention is: a communication method between a virtual machine and a local terminal, which can be applied to a cloud desktop.
[0052] like Figure 2 As shown, in this embodiment, in order to realize communication between the virtual machine and the terminal, a public network server is set as a relay server, and the program in the relay server performs management of registered clients (including virtual machine client programs and terminal client programs) and processes connection requests.
[0053] like Figure 3 As shown, the method of this embodiment includes the following steps:
[0054] S1: The virtual machine sends a first registration request to the relay server and receives a first response message returned by the relay server, wherein the first registration request includes the unique identifier of the virtual machine itself, and the first response message includes the first registration result and the Internet Protocol address (i.e., IP address) of the relay server.
[0055] Specifically, the virtual machine client program automatically starts when the virtual machine is turned on. After the virtual machine client program starts, the unique identifier of the virtual machine (such as MAC address, UUID) and other necessary information (such as IP address) are encapsulated in a suitable data format, and a registration request is sent to the transit server.
[0056] After receiving the registration request from the virtual machine, the relay server processes it, such as storing the relevant information of the virtual machine. Then, the relay server returns a response containing the registration result and connection information to the virtual machine. Once the registration is completed, the connection between the virtual machine and the relay server is established.
[0057] S2: The virtual machine determines whether the first registration result is successful registration. If so, execute step S3. If not, resend the first registration request to the transit server, that is, return to execute step S1.
[0058] S3: The virtual machine generates a connection QR code according to the connection information, and displays the connection QR code on the virtual machine desktop; wherein the connection information includes a unique identifier of the virtual machine and an IP address of the transit server, and may also include the IP address of the virtual machine.
[0059] Specifically, the virtual machine client program generates a QR code based on the information received from the relay server and other necessary information with the help of existing technologies. The QR code contains all necessary connection information, such as the unique identifier of the virtual machine and the IP address of the relay server. The virtual machine client program displays the generated QR code on the top layer of the virtual machine desktop and waits for the terminal to scan the code to connect. The program interacts with the window manager or desktop environment of the virtual machine to ensure that the QR code is always visible.
[0060] S4: The terminal identifies and parses the connection QR code to obtain connection information.
[0061] Specifically, after the terminal client program is started, the local desktop image is captured periodically for QR code recognition. When the terminal does not use the cloud desktop protocol to connect to the virtual machine desktop environment, the target QR code cannot be recognized, and the next screenshot recognition is cycled; when the terminal is connected to the virtual machine desktop environment, the captured desktop image will contain the QR code generated by the virtual machine client program. By performing QR code recognition and analysis on the desktop image, the connection information in the QR code is extracted.
[0062] S5: The terminal sends a second registration request to the relay server according to the Internet Protocol address of the relay server in the connection information, and receives second response information returned by the relay server, wherein the second registration request includes the unique identifier of the terminal itself.
[0063] Specifically, the terminal client program extracts the IP address of the relay server from the QR code, then encapsulates the unique identifier of the local terminal (such as MAC address, UUID) and other necessary information (such as IP address) in a suitable data format, and sends a registration request to the relay server.
[0064] After receiving the registration request from the terminal, the relay server processes it, such as storing the relevant information of the terminal, etc. The relay server returns a response containing the registration result to the terminal. Once the registration is completed, the connection between the terminal and the relay server is established.
[0065] S6: The terminal determines whether the second registration result is successful registration. If so, step S7 is executed. If not, the second registration request is resent to the transfer server, that is, returning to step S5.
[0066] S7: The terminal sends a connection request to the relay server.
[0067] Specifically, after receiving the response of successful registration from the transfer server, the terminal client program encapsulates the virtual machine client-related information and other necessary information obtained from the QR code in a suitable data format and sends a connection request to the server. The connection request includes the unique identifier of the virtual machine to be connected, that is, the unique identifier of the virtual machine obtained by parsing the connection QR code.
[0068] S8: After receiving the connection request, the transit server associates the terminal with the virtual machine to achieve communication between the terminal and the virtual machine.
[0069] Specifically, the transit server receives a connection request from a terminal client, parses the request, determines the validity of relevant information of both connected parties, associates detailed information of the virtual machine and the terminal, and assists both connected parties in establishing communication.
[0070] In this embodiment, the relay server has established communication connections with the virtual machine and the terminal respectively, and the relay server stores the necessary connection information of both parties. Therefore, the relay server can act as an intermediary between the virtual machine and the terminal to assist in establishing a communication connection. For example, using the data packet forwarding method, the relay server will act as a relay point for the data packet, and all data packets can be sent from the terminal to the relay server, and then forwarded by the relay server to the virtual machine, and vice versa.
[0071] In another optional embodiment, the relay server can send the terminal's connection information (such as the terminal's IP address) to the virtual machine, so that the virtual machine and the terminal both have the necessary connection information of the other party, can directly establish a connection, and data is transmitted directly between the virtual machine and the terminal. In this way, the relay server only assists in establishing a direct connection in the initial stage.
[0072] It should be emphasized that the relay server assisting in establishing communications can be implemented using a variety of existing technologies, including but not limited to the above-mentioned examples.
[0073] In this embodiment, a QR code containing connection information is generated by the virtual machine, and the terminal obtains the connection information by capturing the desktop image and identifying the QR code. With the assistance of the relay server, the communication connection between the virtual machine and the terminal is realized, breaking the limitations of the existing cloud desktop protocol and providing a new communication method. By introducing the relay server and QR code technology, the communication connection between the virtual machine and the terminal can be realized without using the cloud desktop protocol.
[0074] In summary, the present invention provides a method and system for communicating between a virtual machine and a local terminal, which can realize a communication connection between a virtual machine and a terminal without using a cloud desktop protocol by introducing a transit server and QR code technology.
[0075] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A communication method between a virtual machine and a local terminal, characterized in that: include: After the virtual machine establishes a connection with the transit server, a connection QR code is generated according to the connection information, and the connection QR code is displayed on the virtual machine desktop, wherein the connection information includes a unique identifier of the virtual machine and an Internet protocol address of the transit server; The terminal identifies and parses the connection QR code to obtain the connection information; The terminal establishes a connection with the transit server according to the connection information, and sends a connection request to the transit server, wherein the connection request includes a unique identifier of the virtual machine; After receiving the connection request, the transit server associates the terminal with the virtual machine to implement communication between the terminal and the virtual machine.
2. The method for communicating between a virtual machine and a local terminal according to claim 1, characterized in that: After the virtual machine establishes a connection with the transit server, a connection QR code is generated according to the connection information, including: The virtual machine sends a first registration request to the relay server, the first registration request includes a unique identifier of the virtual machine, and receives first response information returned by the relay server, the first response information includes a first registration result and an Internet Protocol address of the relay server; If the first registration result is successful registration, the virtual machine generates a connection QR code according to the connection information.
3. The method for communicating between a virtual machine and a local terminal according to claim 1, characterized in that: The displaying of the connection QR code on the virtual machine desktop is specifically: The connection QR code is displayed on the top layer of the virtual machine desktop.
4. The method for communicating between a virtual machine and a local terminal according to claim 3, characterized in that: The terminal identifies and parses the connection QR code to obtain the connection information, including: The terminal captures the virtual machine desktop image according to a preset period, and performs QR code recognition on the virtual machine desktop image to determine whether the connection QR code is recognized; If so, the connection QR code is parsed to obtain the connection information.
5. The method for communication between a virtual machine and a local terminal according to claim 1, characterized in that: The terminal establishes a connection with the relay server according to the connection information, and sends a connection request to the relay server, including: The terminal sends a second registration request to the relay server according to the Internet Protocol address of the relay server in the connection information, wherein the second registration request includes the unique identifier of the terminal, and receives second response information returned by the relay server, wherein the second response information includes a second registration result; If the second registration result is successful registration, the terminal sends a connection request to the transit server, where the connection request includes the unique identifier of the virtual machine.
6. The method for communication between a virtual machine and a local terminal according to claim 5, characterized in that: The connection information further includes an Internet Protocol address of the virtual machine, and the second registration request further includes an Internet Protocol address of the terminal; The implementation of communication between the terminal and the virtual machine is specifically as follows: The transit server sends the Internet Protocol address of the terminal to the virtual machine, so that the virtual machine and the terminal establish a communication connection.
7. The method for communication between a virtual machine and a local terminal according to claim 1, characterized in that: The implementation of communication between the terminal and the virtual machine is specifically as follows: The terminal and the virtual machine communicate through the transit server.
8. A communication system between a cloud desktop and a local terminal, characterized in that: Includes virtual machines, terminals and transit servers; After the virtual machine is used to establish a connection with the transit server, a connection QR code is generated according to the connection information, and the connection QR code is displayed on the virtual machine desktop, wherein the connection information includes a unique identifier of the virtual machine and an Internet protocol address of the transit server; The terminal is used to identify and parse the connection QR code to obtain the connection information; establish a connection with the transit server according to the connection information, and send a connection request to the transit server, wherein the connection request includes a unique identifier of the virtual machine; The transfer server is used to associate the terminal with the virtual machine after receiving the connection request, so as to realize communication between the terminal and the virtual machine.
