CN113472878A - Method and device for realizing file dragging transmission in VNC by using browser plug-in - Google Patents

Method and device for realizing file dragging transmission in VNC by using browser plug-in Download PDF

Info

Publication number
CN113472878A
CN113472878A CN202110728606.7A CN202110728606A CN113472878A CN 113472878 A CN113472878 A CN 113472878A CN 202110728606 A CN202110728606 A CN 202110728606A CN 113472878 A CN113472878 A CN 113472878A
Authority
CN
China
Prior art keywords
file
data
vnc
virtual machine
transmission
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110728606.7A
Other languages
Chinese (zh)
Other versions
CN113472878B (en
Inventor
黄韬
朱家振
王昊
孙作华
吴江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN202110728606.7A priority Critical patent/CN113472878B/en
Publication of CN113472878A publication Critical patent/CN113472878A/en
Application granted granted Critical
Publication of CN113472878B publication Critical patent/CN113472878B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2212/00Encapsulation of packets

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for realizing file dragging transmission in VNC by using a browser plug-in, which comprises the following steps: the method comprises the steps that a NOVNC serves as a client, a plug-in is installed in a browser, a dragging event is captured, dragging elements are decomposed, file information is obtained, and file contents are read; and performing data encapsulation on the file content according to the extended RFB protocol format, and realizing bidirectional data transmission through WebSocket connection between the browser and VNC proxy service, namely dragging transmission of the host file to the virtual machine and dragging transmission of the virtual machine file to the host. The method and the system conveniently and effectively solve the problem of bidirectional file dragging transmission between the host and the virtual machine, so that the VNC is more convenient to use and richer in function; the method has the advantages of cost of cloud computing and convenience of the virtualized software client, and brings great improvement to functions and use experience of the cloud computing and virtualized control panel. The invention also provides a corresponding device for realizing the file dragging transmission in the VNC by utilizing the browser plug-in.

Description

Method and device for realizing file dragging transmission in VNC by using browser plug-in
Technical Field
The invention belongs to the technical field of cloud computing, and particularly relates to a method and a device for realizing file dragging transmission in a VNC (virtual network computer) by using a browser plug-in.
Background
A Virtual Network Console (VNC) is a piece of remote control tool software. The Remote Frame Buffer (RFB) protocol is used for transmission, and is widely used in cloud computing and virtualization scenes.
Traditional virtualization software such as VMware, VirtualBox and the like can realize bidirectional file dragging transmission between a host and a virtual machine by installing Tools (enhanced Tools) in the virtual machine and combining special client software, and the file transmission is very convenient.
The noVNC is accessible as an open-source VNC client implemented in HTML5 through a browser. Due to its light weight, it is convenient to be used in various large cloud computing and virtualized control panels. But also has the defect that the function is single and the file can not be transmitted.
In the prior art, most of the special client software combines with the modified desktop protocol to realize file transmission, and is locked by manufacturers with the client software, and part of the client software needs the special desktop protocol and does not support the limitations of bidirectional transmission and the like. The method has the defects of complex installation, overweight frame, high resource utilization rate and the like. When the noVNC is used as the control panel, it is desired to realize File Transfer only by software supporting File Transfer protocols such as FTP (File Transfer Protocol), SFTP (Secure File Transfer Protocol), SCP (Secure Copy Protocol), etc. by WinSCP, and the network between the host and the virtual machine needs to be intercommunicated.
Disclosure of Invention
Aiming at the defects or improvement requirements of the prior art, the invention provides a scheme for realizing file dragging transmission in VNC by using a browser plug-in, the lightweight and convenient NoVNC is used, the file dragging bidirectional transmission function like a virtualization special software client is realized, the file transmission between a virtual machine and a host is convenient and quick, the usability of the VNC is greatly enhanced, and the use experience of a cloud computing control panel is more friendly.
To achieve the above object, according to an aspect of the present invention, there is provided a method for implementing drag and drop transmission of a file in a VNC by using a browser plug-in, including:
the method comprises the steps that a NOVNC serves as a client, a plug-in is installed in a browser, a dragging event is captured, dragging elements are decomposed, file information is obtained, and file contents are read;
and performing data encapsulation on the file content according to the extended RFB protocol format, and realizing bidirectional data transmission through WebSocket connection between the browser and VNC proxy service, namely dragging transmission of the host file to the virtual machine and dragging transmission of the virtual machine file to the host.
In an embodiment of the present invention, the extended RFB protocol format includes:
message type, used to distinguish other message events;
the transmission direction identifier is used for distinguishing the file transmission direction;
the unique identifier is used for marking the uniqueness of the data, and when the data is sent for multiple times, the data is fragmented and recombined to avoid confusing the fragmented data;
the fragment identifier is used for identifying whether the received fragment data is to be received or not in the follow-up process;
the fragment number is used for recording the number of the data fragment in the transmission;
the file information length is used for defining the byte length of the file information;
file information for transmitting the file information;
a file length for defining a byte length of file data;
file content for transmitting the file content.
In an embodiment of the present invention, the dragging and transmitting of the host file to the virtual machine includes:
and performing data encapsulation according to an extended RFB protocol format, transmitting data to VNC proxy services through WebSocket connection between a browser and the VNC proxy services, installing proxy software in the virtual machine for receiving the data forwarded to the VNC services by the VNC proxy services, analyzing the data by the virtual machine proxy software, completing the creation and writing of files, and realizing the dragging transmission of host files to the virtual machine.
In an embodiment of the present invention, the dragging transmission of the host file to the virtual machine is specifically implemented as follows:
the native machine initiates a file dragging action, and drags the file to a NOVNC display range of the virtual machine;
the browser plug-in captures a dragging action, acquires a dragging element and reads a file; packaging the read file information and file data according to an expanded RFB protocol format;
the transmission is carried out through WebSocket connection between the browser and VNC proxy service; the VNC proxy service forwards the received data to the VNC service;
the VNC service receives the data to judge the data type and reserves the expanded RFB protocol data;
the VNC proxy service forwards the data of the VNC service to the browser through WebSocket connection between the VNC proxy service and the browser;
after the agent software in the virtual machine acquires the data reserved by the VNC service, the data is analyzed to obtain file information, a file is created according to the file information, and the content of the file is written in until the file is completely transmitted.
In an embodiment of the present invention, the dragging and transmitting of the virtual machine file to the host includes:
capturing a dragging event by using a browser plug-in, informing virtual machine agent software to read a file, performing data encapsulation on the file content according to an extended RFB protocol format and transmitting the data to a VNC service, forwarding the VNC service data to a browser by the VNC agent service through WebSocket connection between the VNC service and the browser, and after receiving the transmitted data, analyzing the data by the browser plug-in to complete the creation and writing of the file, thereby realizing the dragging transmission of the virtual machine file to a host.
In an embodiment of the present invention, the dragging and transmitting of the virtual machine file to the host is specifically implemented as follows:
initiating a file dragging action in the virtual machine, and dragging the file to a NoVNC boundary;
the browser plug-in detects a dragging event and informs virtual machine agent software;
after receiving the notification, the virtual machine agent software acquires the information of the dragged file in the virtual machine and starts to read the file, encapsulates the file information and the file data according to the expanded RFB protocol format, and transmits the encapsulated data to VNC service;
the VNC service judges the data type and transmits the data of the expanded RFB protocol to VNC proxy service;
the VNC proxy service forwards the data of the VNC service to the browser through WebSocket connection between the VNC proxy service and the browser;
the browser plug-in analyzes the data received by the browser, takes the file information according to the expanded RFB protocol format, creates a file according to the file information, and writes the content of the file until the file is completely transmitted.
In an embodiment of the present invention, encapsulating file information and file data according to an extended RFB protocol format includes:
packaging the data message type, the transmission direction identification and the unique identification field, filling the read file information into the file information field according to a defined sequence, calculating the length of the file information, filling the length of the read file into the length of the file through calculation, filling the content of the file into the content of the file, and if the content of the file is overlarge, calculating and filling the fragment number and the fragment identification by controlling the length of the file and the content of the file to realize breakpoint continuous transmission and transmit the data for multiple times;
dragging and transmitting the host file to the virtual machine, wherein the file transmission direction is 0, the dragging and transmitting of the virtual machine file to the host is 1; or, the host file is dragged and transmitted to the virtual machine, the file transmission direction is 1, the virtual machine file is dragged and transmitted to the host, and the file transmission direction is 0.
According to another aspect of the present invention, there is also provided an apparatus for implementing drag and drop transmission of a file in a VNC by using a browser plug-in, including a file reading module and a file transmission module, where:
the file reading module is used for capturing a dragging event and decomposing a dragging element by using a NOVNC as a client and installing a plug-in a browser, so as to obtain file information and read file contents;
the file transmission module is used for packaging the file content according to the extended RFB protocol format and realizing the bidirectional transmission of data through the WebSocket connection between the browser and the VNC proxy service, namely the dragging transmission of the host file to the virtual machine and the dragging transmission of the virtual machine file to the host.
In an embodiment of the present invention, the extended RFB protocol format includes:
message type, used to distinguish other message events;
the transmission direction identifier is used for distinguishing the file transmission direction;
the unique identifier is used for marking the uniqueness of the data, and when the data is sent for multiple times, the data is fragmented and recombined to avoid confusing the fragmented data;
the fragment identifier is used for identifying whether the received fragment data is to be received or not in the follow-up process;
the fragment number is used for recording the number of the data fragment in the transmission;
the file information length is used for defining the byte length of the file information;
file information for transmitting the file information;
a file length for defining a byte length of file data;
file content for transmitting the file content.
In an embodiment of the present invention, the dragging and transmitting of the host file to the virtual machine includes: data are packaged according to an extended RFB protocol format, data are transmitted to VNC proxy services through WebSocket connection between a browser and the VNC proxy services, proxy software is installed in a virtual machine and used for receiving the data forwarded to the VNC services by the VNC proxy services, the virtual machine proxy software analyzes the data, file creation and writing are completed, and dragging transmission of host files to the virtual machine is achieved;
the dragging transmission of the virtual machine file to the host comprises the following steps: capturing a dragging event by using a browser plug-in, informing virtual machine agent software to read a file, performing data encapsulation on the file content according to an extended RFB protocol format and transmitting the data to a VNC service, forwarding the VNC service data to a browser by the VNC agent service through WebSocket connection between the VNC service and the browser, and after receiving the transmitted data, analyzing the data by the browser plug-in to complete the creation and writing of the file, thereby realizing the dragging transmission of the virtual machine file to a host.
Generally, compared with the prior art, the technical scheme of the invention has the following beneficial effects:
(1) the invention can realize the bidirectional file dragging transmission between the virtual machine and the local system by using the browser plug-in without installing a desktop client or a virtualization software client, does not need network intercommunication between the virtual machine and the local system, and performs data transmission by using the browser and a transmission channel of VNC service to the virtual machine. The problem of bidirectional file dragging transmission between a host and a virtual machine is conveniently and effectively solved, and the VNC is more convenient to use and richer in function;
(2) the method is used as a control panel of various cloud computing and virtualization, the NOVNC with the file dragging and transmitting function is added, the use experience is not inferior to that of a special client of the traditional virtualization software, the cost advantage of the cloud computing is achieved, the convenience of the client of the virtualization software is also considered, and the method brings great improvement to the functions and the use experience of the cloud computing and virtualization control panel.
Drawings
FIG. 1 is a schematic diagram illustrating a process of dragging and transmitting a file from a host to a virtual machine according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a process of dragging and transmitting a file from a host to a virtual machine according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a process of dragging and transmitting a file from a virtual machine to a host according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a process of dragging and transmitting a file from a virtual machine to a host in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
The invention provides a method for realizing file dragging transmission in a VNC (virtual network computer) by using a browser plug-in, which comprises the following steps:
the virtual computing node deploys VNC service, the virtual management node deploys VNC agent service, the host computer installs a browser, and virtual machine agent software is installed in a virtual machine to be transmitted. The method comprises the steps that a host browser uses a NoVNC as a client, a plug-in is installed in the browser, a dragging event is captured, dragging elements are decomposed, file information is obtained, and file contents are read;
and performing data encapsulation on the file content according to the extended RFB protocol format, and realizing bidirectional data transmission through WebSocket connection between the browser and VNC proxy service, namely dragging transmission of the host file to the virtual machine and dragging transmission of the virtual machine file to the host.
The RFB protocol extension:
RFB is an application layer protocol based on TCP, a simple protocol for remote access to graphical user interfaces. Protocol extensions and message definitions are supported.
The invention defines new FileTransfer extension protocol content, which comprises file information and file data. The browser plug-in and the virtual machine agent software package and analyze data according to the protocol format, and the original VNC transmission flow is not affected.
An extended RFB protocol format comprising at least the following fields:
message type, used to distinguish other message events;
the transmission direction identifier is used for distinguishing the file transmission direction;
the unique identifier is used for marking the uniqueness of the data, and when the data is sent for multiple times, the data is fragmented and recombined to avoid confusing the fragmented data;
the fragment identifier is used for identifying whether the received fragment data is to be received or not in the follow-up process;
the fragment number is used for recording the number of the data fragment in the transmission;
the file information length is used for defining the byte length of the file information;
file information for transmitting the file information;
a file length for defining a byte length of file data;
file content for transmitting the file content.
As shown in table 1, the extended RFB protocol includes:
the message type, which describes and defines a new message-type, is located in the message header, occupies 1 byte, and has a type of U8, and is used for distinguishing other message events. The value ranges are unsigned integers that are not repeated with other messages.
The latter field padding is a padding field, occupies 3 bytes, and is reserved for the message.
The latter field is U8, and is transmission direction identification, occupies 1 byte, and is used for distinguishing the file transmission direction, namely data-transfer-direction. 0 represents a host to virtual machine transfer and 1 represents a virtual machine to host transfer.
The latter field padding is a padding field, occupies 3 bytes, and is reserved for the message.
The latter field is U8, is a unique identifier, occupies one byte, and is used to mark data uniqueness, i.e., identification. When the data is sent for multiple times, the fragmentation and recombination avoid mixing up the fragmented data.
The latter field padding is a padding field, occupies 3 bytes, and is reserved for the message.
The latter field is U8 in type, occupies 1 byte for the fragment identification, and is used for identifying whether fragment data to be received, namely fragment-flag, is left in the received fragment data. 1 represents that there is still a slice following, 0 represents that the slice ends, so the value of the last slice is 0.
The latter field padding is a padding field, occupies 3 bytes, and is reserved for the message.
The latter field is of type U32, and is a fragment number, and occupies 4 bytes, and is used to record the number of the data fragment in this transmission, i.e. fragment-num. When in sending, the number of the fragments is increased from 1, and the last fragment needs to be provided with a fragment ending mark.
The latter field is U32, and is a file information length, occupies 4 bytes, and is used to define the byte length of the file information, i.e. file-info-length, which is a length of bytes that needs to be calculated during filling and is aligned by 4 bytes.
The latter field type is an array of U8 type, is file information, occupies file-info-length bytes, is used to transmit file information, i.e. file-info, and records: file name, short file name, file attributes, creation date, last modification time, path, short path, size, type information. Padding data is required to maintain 4-byte alignment.
The latter field type is U32, and is a file length, which is used to define the byte length of file data, i.e. text-length, and the length is the byte length, and needs to be calculated during filling, and is aligned by 4 bytes.
The last field type is an array of a U8 type, the last field type is file content, a text-length byte is occupied, the last field type is used for transmitting the file content, namely the text, and fragment-num and fragment-flag can be calculated and filled by controlling the text-length and the text, so that breakpoint continuous transmission is realized, and data is transmitted for multiple times. Padding data is required to maintain 4-byte alignment.
Table 1 RFB protocol extension description
Figure BDA0003138473640000091
It should be understood that the above general description of table 1 is exemplary and explanatory only and is not restrictive of the application, as other formal sequences and combinations of field lengths are possible.
The method for dragging and transmitting the host file to the virtual machine comprises the following steps:
and capturing the dragging event by using the browser plug-in, decomposing the dragging element, acquiring file information, and reading the file content. And performing data encapsulation on the file content according to the extended RFB protocol format and transmitting the data to the VNC proxy service through WebSocket connection between the browser and the VNC proxy service. And meanwhile, installing agent software in the virtual machine, wherein the agent software is used for receiving data forwarded to the VNC service by the VNC agent service, and the virtual machine agent software analyzes the data to complete the creation and writing of the file. Therefore, dragging transmission of the host file to the virtual machine is realized.
Specifically, as shown in fig. 1, the process of dragging and transmitting the file to the virtual machine by the host is as follows:
1. the native machine initiates a file dragging action, and drags the file to a NOVNC display range of the virtual machine;
2. and capturing the dragging action by the browser plug-in, acquiring a dragging element, and reading the file. And packaging the read file information and file data according to the extended RFB protocol format. The type of the encapsulated data message is FileTransfer, the file transmission direction is 0, a data unique identifier and a fragment identifier are filled, read file information is filled in a file-info field according to a defined sequence, the length of the file-info field is calculated and filled in the file-info-length field, the length of the read file is calculated and filled in the text-length field, and the content of the file is filled in the text field. If the content of the file is too large, fragment-num and fragment-flag fields can be calculated and filled by controlling the length of the text-length and the content of the text, so that breakpoint continuous transmission is realized, and data is transmitted for multiple times.
3. The transmission is via a WebSocket connection between the browser and the VNC proxy service. The VNC proxy service forwards the received data to the VNC service.
And 4, the VNC service receives the data to judge the data type and reserves the extended RFB protocol data.
5. After the virtual machine agent software acquires data reserved by the VNC service, the data is analyzed to obtain file information (data such as file-info, text and the like are taken according to a defined FileTransfer format), a file is created according to the file information, and file content is written in until the file is completely transmitted.
As shown in fig. 2, the implementation method includes the following steps:
step 201: and dragging the file to the range of the control panel of the virtual machine.
Step 202: the browser plug-in captures the drag event.
And 203, acquiring the dragging element, and acquiring file information and file data. And (5) judging that the acquisition is successful, entering a step 205, and if the acquisition is unsuccessful, entering a step 204, and popping up an alarm box by the browser to prompt failure information.
Step 205: and performing data encapsulation on the acquired file information and file contents according to an extended RFB protocol, continuously reading file data, and transmitting the encapsulated data until the file is transmitted.
Step 206: and transmitting the encapsulated data to the VNC proxy service and forwarding the data to the VNC service.
Step 207: and the virtual machine agent software reads data from the VNC service and analyzes the data according to the extended RFB protocol.
And 208, judging the data analysis result, entering a step 209 if the data analysis is successful, and entering a step 204 if the data analysis is failed, wherein the browser pops up an alarm box to prompt failure information.
Step 209: and the virtual machine agent software creates a file according to the file information in the analyzed data.
Step 210: judging the file creating state, entering step 211 if the file creating is successful, and entering step 204 if the file creating is failed, popping up an alarm box by the browser, and prompting failure information.
Step 211: and the virtual machine agent software writes file data according to the file content in the analyzed data.
In step 212, it is determined whether the file is completely written. If the writing process is completed, the step 213 is entered, and if the writing process is not completed, the step 211 is entered, and the writing process continues until all the writing process of the file data is completed.
And step 213, after the file is written, dragging transmission is finished. Step 214 is entered.
And step 214, the browser pops a frame to prompt that the file is transmitted, and the host drags the virtual machine to finish the transmission process.
The method for dragging and transmitting the virtual machine file to the host comprises the following steps:
and capturing the dragging event by using a browser plug-in, informing virtual machine agent software to read the file, and performing data encapsulation on the file content according to the extended RFB protocol format and transmitting the file content to VNC service. And the VNC proxy service forwards VNC service data to the browser through WebSocket connection between the VNC proxy service and the browser, and the browser plug-in receives the transmitted data and then analyzes the data to complete the creation and writing of the file. Therefore, dragging and transmission of the virtual machine file to the host are achieved.
Specifically, as shown in fig. 3, the virtual machine drags the host file as follows:
1. and initiating a file dragging action in the virtual machine, and dragging to a NoVNC boundary.
2. And the browser plug-in detects the dragging event and informs the virtual machine agent software.
3. And after receiving the notification, the virtual machine agent software acquires the information of the dragged file in the virtual machine and starts to read the file. And encapsulating the file information and the file data according to the extended RFB protocol format. The package data message-type is FileTransfer, the file transmission direction is 1, a data unique identifier and a fragment identifier are filled, read file information is filled in a file-info field according to a defined sequence, the length of the file-info field is calculated and filled in the file-info-length field, the length of the read file is calculated and filled in the text-length field, and the content of the file is filled in the text field. If the content of the file is too large, fragment-num and fragment-flag fields can be calculated and filled by controlling the length of the text-length and the content of the text, so that breakpoint continuous transmission is realized, and data is transmitted for multiple times. And transmitting the encapsulated data to a VNC service.
And 4, the VNC service judges the data type and transmits the data of the extended RFB protocol to the VNC proxy service.
And 5, forwarding the data of the VNC service to the browser through the WebSocket connection between the VNC proxy service and the browser.
6. The browser plug-in analyzes the data received by the browser, takes file information (including file-info, text and other data) according to a defined FileTransfer format, creates a file according to the file information, and writes file content until the file is completely transmitted.
As shown in fig. 4, the implementation method includes the following steps:
step 401, dragging the file from the control panel of the virtual machine to the boundary of the control panel.
Step 402, detecting a dragging event by the browser plug-in, entering step 403 if the detection is successful, entering step 404 if the detection is failed, informing virtual machine agent software, and prompting failure information by an agent software prompt box.
And 403, the browser plug-in informs the virtual machine agent software, and the agent software acquires the dragging element in the virtual machine and acquires file information and file data. The interpretation and acquisition success enters step 405, if the acquisition failure occurs, the step 404 is entered to notify the virtual machine agent software, and the agent software prompt box prompts failure information.
And 405, performing data encapsulation on the acquired file information and file contents according to an extended RFB protocol, continuously reading file data, and transmitting the encapsulated data until the file is transmitted.
And step 406, transmitting the encapsulated data to a VNC service and forwarding the data to the browser through the VNC proxy service.
Step 407, after the browser plug-in obtains the data, the data is analyzed according to the extended RFB protocol.
Step 408, interpreting the analysis result, entering step 409 if the analysis is successful, entering step 404 if the analysis is failed, informing virtual machine agent software, and prompting failure information by an agent software prompt box.
Step 409: and the browser plug-in creates a file according to the file information in the analyzed data.
Step 410, interpreting the file creation state, entering step 411 if the file creation is successful, entering step 404 if the file creation is failed, informing the virtual machine agent software, and prompting failure information by an agent software prompt box.
And 411, the browser plug-in writes the file data according to the file content in the analyzed data.
In step 412, whether the file is written completely is determined. If the writing is completed, the step 413 is performed, and if the writing is not completed, the step 411 is performed to continue writing the file data until all the file data are written.
And 413, after the file is written, finishing the dragging transmission. Step 414 is entered.
And step 414, prompting the completion of file transmission by the agent software prompt box, and finishing the dragging and transmission process of the virtual machine to the host.
Further, the invention also provides a device for realizing the drag and drop transmission of the file in the VNC by using the browser plug-in, which comprises a file reading module and a file transmission module, wherein:
the file reading module is used for capturing a dragging event and decomposing a dragging element by using a NOVNC as a client and installing a plug-in a browser, so as to obtain file information and read file contents;
the file transmission module is used for packaging the file content according to the extended RFB protocol format and realizing the bidirectional transmission of data through the WebSocket connection between the browser and the VNC proxy service, namely the dragging transmission of the host file to the virtual machine and the dragging transmission of the virtual machine file to the host.
Wherein the extended RFB protocol format comprises:
message type, used to distinguish other message events;
the transmission direction identifier is used for distinguishing the file transmission direction;
the unique identifier is used for marking the uniqueness of the data, and when the data is sent for multiple times, the data is fragmented and recombined to avoid confusing the fragmented data;
the fragment identifier is used for identifying whether the received fragment data is to be received or not in the follow-up process;
the fragment number is used for recording the number of the data fragment in the transmission;
the file information length is used for defining the byte length of the file information;
file information for transmitting the file information;
a file length for defining a byte length of file data;
file content for transmitting the file content.
Further, the dragging and transmitting of the host file to the virtual machine includes: data are packaged according to an extended RFB protocol format, data are transmitted to VNC proxy services through WebSocket connection between a browser and the VNC proxy services, proxy software is installed in a virtual machine and used for receiving the data forwarded to the VNC services by the VNC proxy services, the virtual machine proxy software analyzes the data, file creation and writing are completed, and dragging transmission of host files to the virtual machine is achieved;
the dragging transmission of the virtual machine file to the host comprises the following steps: capturing a dragging event by using a browser plug-in, informing virtual machine agent software to read a file, performing data encapsulation on the file content according to an extended RFB protocol format and transmitting the data to a VNC service, forwarding the VNC service data to a browser by the VNC agent service through WebSocket connection between the VNC service and the browser, and after receiving the transmitted data, analyzing the data by the browser plug-in to complete the creation and writing of the file, thereby realizing the dragging transmission of the virtual machine file to a host.
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and that any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for realizing drag and drop transmission of a file in a VNC by using a browser plug-in is characterized by comprising the following steps:
the method comprises the steps that a NOVNC serves as a client, a plug-in is installed in a browser, a dragging event is captured, dragging elements are decomposed, file information is obtained, and file contents are read;
and performing data encapsulation on the file content according to the extended RFB protocol format, and realizing bidirectional data transmission through WebSocket connection between the browser and VNC proxy service, namely dragging transmission of the host file to the virtual machine and dragging transmission of the virtual machine file to the host.
2. The method for implementing a file drag transfer in a VNC using a browser plug-in of claim 1, wherein the extended RFB protocol format comprises:
message type, used to distinguish other message events;
the transmission direction identifier is used for distinguishing the file transmission direction;
the unique identifier is used for marking the uniqueness of the data, and when the data is sent for multiple times, the data is fragmented and recombined to avoid confusing the fragmented data;
the fragment identifier is used for identifying whether the received fragment data is to be received or not in the follow-up process;
the fragment number is used for recording the number of the data fragment in the transmission;
the file information length is used for defining the byte length of the file information;
file information for transmitting the file information;
a file length for defining a byte length of file data;
file content for transmitting the file content.
3. The method for implementing file drag transfer in VNC by using browser plug-in according to claim 1 or 2, wherein the drag transfer of the host file to the virtual machine includes:
and performing data encapsulation according to an extended RFB protocol format, transmitting data to VNC proxy services through WebSocket connection between a browser and the VNC proxy services, installing proxy software in the virtual machine for receiving the data forwarded to the VNC services by the VNC proxy services, analyzing the data by the virtual machine proxy software, completing the creation and writing of files, and realizing the dragging transmission of host files to the virtual machine.
4. The method for realizing file drag transmission in the VNC by using a browser plug-in as claimed in claim 3, wherein the drag transmission of the host file to the virtual machine is specifically realized by:
the native machine initiates a file dragging action, and drags the file to a NOVNC display range of the virtual machine;
the browser plug-in captures a dragging action, acquires a dragging element and reads a file; packaging the read file information and file data according to an expanded RFB protocol format;
the transmission is carried out through WebSocket connection between the browser and VNC proxy service; the VNC proxy service forwards the received data to the VNC service;
the VNC service receives the data to judge the data type and reserves the expanded RFB protocol data;
the VNC proxy service forwards the data of the VNC service to the browser through WebSocket connection between the VNC proxy service and the browser;
after the agent software in the virtual machine acquires the data reserved by the VNC service, the data is analyzed to obtain file information, a file is created according to the file information, and the content of the file is written in until the file is completely transmitted.
5. The method for implementing file drag transmission in VNC by using browser plug-in according to claim 1 or 2, wherein the drag transmission of the virtual machine file to the host includes:
capturing a dragging event by using a browser plug-in, informing virtual machine agent software to read a file, performing data encapsulation on the file content according to an extended RFB protocol format and transmitting the data to a VNC service, forwarding the VNC service data to a browser by the VNC agent service through WebSocket connection between the VNC service and the browser, and after receiving the transmitted data, analyzing the data by the browser plug-in to complete the creation and writing of the file, thereby realizing the dragging transmission of the virtual machine file to a host.
6. The method for implementing file drag transmission in VNC by using a browser plug-in as claimed in claim 5, wherein the drag transmission of the virtual machine file to the host is implemented by:
initiating a file dragging action in the virtual machine, and dragging the file to a NoVNC boundary;
the browser plug-in detects a dragging event and informs virtual machine agent software;
after receiving the notification, the virtual machine agent software acquires the information of the dragged file in the virtual machine and starts to read the file, encapsulates the file information and the file data according to the expanded RFB protocol format, and transmits the encapsulated data to VNC service;
the VNC service judges the data type and transmits the data of the expanded RFB protocol to VNC proxy service;
the VNC proxy service forwards the data of the VNC service to the browser through WebSocket connection between the VNC proxy service and the browser;
the browser plug-in analyzes the data received by the browser, takes the file information according to the expanded RFB protocol format, creates a file according to the file information, and writes the content of the file until the file is completely transmitted.
7. The method for implementing file drag transmission in VNC by using browser plug-in according to claim 4 or 6, wherein encapsulating file information and file data according to extended RFB protocol format comprises:
packaging the data message type, the transmission direction identification and the unique identification field, filling the read file information into the file information field according to a defined sequence, calculating the length of the file information, filling the length of the read file into the length of the file through calculation, filling the content of the file into the content of the file, and if the content of the file is overlarge, calculating and filling the fragment number and the fragment identification by controlling the length of the file and the content of the file to realize breakpoint continuous transmission and transmit the data for multiple times;
dragging and transmitting the host file to the virtual machine, wherein the file transmission direction is 0, the dragging and transmitting of the virtual machine file to the host is 1; or, the host file is dragged and transmitted to the virtual machine, the file transmission direction is 1, the virtual machine file is dragged and transmitted to the host, and the file transmission direction is 0.
8. A device for realizing dragging and transmitting of a file in a VNC by using a browser plug-in is characterized by comprising a file reading module and a file transmitting module, wherein:
the file reading module is used for capturing a dragging event and decomposing a dragging element by using a NOVNC as a client and installing a plug-in a browser, so as to obtain file information and read file contents;
the file transmission module is used for packaging the file content according to the extended RFB protocol format and realizing the bidirectional transmission of data through the WebSocket connection between the browser and the VNC proxy service, namely the dragging transmission of the host file to the virtual machine and the dragging transmission of the virtual machine file to the host.
9. The apparatus for implementing file drag delivery in VNC using browser plug-in of claim 8, wherein the extended RFB protocol format comprises:
message type, used to distinguish other message events;
the transmission direction identifier is used for distinguishing the file transmission direction;
the unique identifier is used for marking the uniqueness of the data, and when the data is sent for multiple times, the data is fragmented and recombined to avoid confusing the fragmented data;
the fragment identifier is used for identifying whether the received fragment data is to be received or not in the follow-up process;
the fragment number is used for recording the number of the data fragment in the transmission;
the file information length is used for defining the byte length of the file information;
file information for transmitting the file information;
a file length for defining a byte length of file data;
file content for transmitting the file content.
10. The apparatus for implementing file drag transfer in VNC by using browser plug-in according to claim 8 or 9,
the dragging transmission of the host file to the virtual machine comprises the following steps: data are packaged according to an extended RFB protocol format, data are transmitted to VNC proxy services through WebSocket connection between a browser and the VNC proxy services, proxy software is installed in a virtual machine and used for receiving the data forwarded to the VNC services by the VNC proxy services, the virtual machine proxy software analyzes the data, file creation and writing are completed, and dragging transmission of host files to the virtual machine is achieved;
the dragging transmission of the virtual machine file to the host comprises the following steps: capturing a dragging event by using a browser plug-in, informing virtual machine agent software to read a file, performing data encapsulation on the file content according to an extended RFB protocol format and transmitting the data to a VNC service, forwarding the VNC service data to a browser by the VNC agent service through WebSocket connection between the VNC service and the browser, and after receiving the transmitted data, analyzing the data by the browser plug-in to complete the creation and writing of the file, thereby realizing the dragging transmission of the virtual machine file to a host.
CN202110728606.7A 2021-06-29 2021-06-29 Method and device for realizing file dragging transmission in VNC by using browser plug-in Active CN113472878B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110728606.7A CN113472878B (en) 2021-06-29 2021-06-29 Method and device for realizing file dragging transmission in VNC by using browser plug-in

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110728606.7A CN113472878B (en) 2021-06-29 2021-06-29 Method and device for realizing file dragging transmission in VNC by using browser plug-in

Publications (2)

Publication Number Publication Date
CN113472878A true CN113472878A (en) 2021-10-01
CN113472878B CN113472878B (en) 2022-04-26

Family

ID=77873793

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110728606.7A Active CN113472878B (en) 2021-06-29 2021-06-29 Method and device for realizing file dragging transmission in VNC by using browser plug-in

Country Status (1)

Country Link
CN (1) CN113472878B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114172897A (en) * 2021-12-09 2022-03-11 西安邮电大学 PC (personal computer) end and Android end file transmission method and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103200215A (en) * 2012-01-08 2013-07-10 佳都新太科技股份有限公司 Method achieving XenServer virtual machine remote control on https
CN103618737A (en) * 2013-12-10 2014-03-05 浪潮电子信息产业股份有限公司 VNC console optimization scheme of virtual machines in cloud computing environment
US20150100624A1 (en) * 2013-10-09 2015-04-09 International Business Machines Corporation Method and system for supporting vnc/rfb protocol tranversal through firewalls without the need to configure open ports
CN104580531A (en) * 2015-02-05 2015-04-29 湖南合天智汇信息技术有限公司 Web remote desktop access control method based on WebSocket agency
CN105338048A (en) * 2014-08-13 2016-02-17 北京云端时代科技有限公司 File transmission method and system under virtual desktop infrastructure
CN105389096A (en) * 2015-10-27 2016-03-09 深圳市深信服电子科技有限公司 Browser based data interaction method and apparatus
CN105933415A (en) * 2016-04-21 2016-09-07 国家计算机网络与信息安全管理中心 Virtual machine online screen record method in cloud computing environment based on VNC agent and virtual machine online screen record system thereof
CN107634892A (en) * 2017-09-08 2018-01-26 郑州云海信息技术有限公司 A kind of Xenserver realizes the method and device of console based on novnc
US20190230152A1 (en) * 2018-01-24 2019-07-25 Vmware, Inc. File and folder redirection for virtual desktops via image scanning
CN111371885A (en) * 2020-02-29 2020-07-03 苏州浪潮智能科技有限公司 Method, device, equipment and medium for transmitting file to VMWare virtual machine

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103200215A (en) * 2012-01-08 2013-07-10 佳都新太科技股份有限公司 Method achieving XenServer virtual machine remote control on https
US20150100624A1 (en) * 2013-10-09 2015-04-09 International Business Machines Corporation Method and system for supporting vnc/rfb protocol tranversal through firewalls without the need to configure open ports
CN103618737A (en) * 2013-12-10 2014-03-05 浪潮电子信息产业股份有限公司 VNC console optimization scheme of virtual machines in cloud computing environment
CN105338048A (en) * 2014-08-13 2016-02-17 北京云端时代科技有限公司 File transmission method and system under virtual desktop infrastructure
CN104580531A (en) * 2015-02-05 2015-04-29 湖南合天智汇信息技术有限公司 Web remote desktop access control method based on WebSocket agency
CN105389096A (en) * 2015-10-27 2016-03-09 深圳市深信服电子科技有限公司 Browser based data interaction method and apparatus
CN105933415A (en) * 2016-04-21 2016-09-07 国家计算机网络与信息安全管理中心 Virtual machine online screen record method in cloud computing environment based on VNC agent and virtual machine online screen record system thereof
CN107634892A (en) * 2017-09-08 2018-01-26 郑州云海信息技术有限公司 A kind of Xenserver realizes the method and device of console based on novnc
US20190230152A1 (en) * 2018-01-24 2019-07-25 Vmware, Inc. File and folder redirection for virtual desktops via image scanning
CN111371885A (en) * 2020-02-29 2020-07-03 苏州浪潮智能科技有限公司 Method, device, equipment and medium for transmitting file to VMWare virtual machine

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114172897A (en) * 2021-12-09 2022-03-11 西安邮电大学 PC (personal computer) end and Android end file transmission method and system
CN114172897B (en) * 2021-12-09 2023-08-25 西安邮电大学 Method and system for transmitting files of PC (personal computer) end and Android end

Also Published As

Publication number Publication date
CN113472878B (en) 2022-04-26

Similar Documents

Publication Publication Date Title
CN111083225A (en) Data processing method and device in Internet of things platform and Internet of things platform
WO2021189954A1 (en) Log data processing method and apparatus, computer device, and storage medium
US20120072969A1 (en) Determining a sensitivity label of document information in real time
TW200404225A (en) Dynamic wizard interface system and method
CN113806116A (en) Protocol stack data transmission method based on Linux system, computer equipment and storage medium
CN105082540A (en) Method for controlling 3D printer through 3D slicing device
CN112764946B (en) Cross-process data transmission method and device, electronic equipment and storage medium
CN107800663A (en) The detection method and device of flow off-line files
CN113472878B (en) Method and device for realizing file dragging transmission in VNC by using browser plug-in
CN105389120A (en) Supporting RMA API over active message
CN105190530A (en) Transmitting hardware-rendered graphical data
CN102752371A (en) Method for achieving splash on client side and client side
CN112994982A (en) Packet capture control method, device and system of cloud-real machine and storage medium
US8813029B2 (en) Remote card content management using synchronous server-side scripting
US20090113017A1 (en) Arrangements for A 3270 compatible terminal with browser capability
CN113722116A (en) Debugging message transmission method, device, equipment and medium
CN107861821B (en) Mining method and device for module call relation and computer readable medium
CN113761412A (en) Application page display method and device, electronic equipment, medium and application system
CN109189652A (en) A kind of acquisition method and system of close network terminal behavior data
CN112399446A (en) Edge gateway communication method, device, computer equipment and storage medium
CN116647490A (en) Aviation AFDX network data detection system
CN113590564B (en) Data storage method, device, electronic equipment and storage medium
CN112698829B (en) Abnormal resource positioning method and device, storage medium and electronic equipment
CN103838586A (en) System and method for opening file
CN113645316A (en) Upgrade data processing method, upper computer, lower computer, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant