CN115914210A - File transmission method, device and system based on virtual network - Google Patents

File transmission method, device and system based on virtual network Download PDF

Info

Publication number
CN115914210A
CN115914210A CN202211458621.5A CN202211458621A CN115914210A CN 115914210 A CN115914210 A CN 115914210A CN 202211458621 A CN202211458621 A CN 202211458621A CN 115914210 A CN115914210 A CN 115914210A
Authority
CN
China
Prior art keywords
message
data
forwarding device
client
specific
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.)
Pending
Application number
CN202211458621.5A
Other languages
Chinese (zh)
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.)
China Telecom Cloud Technology Co Ltd
Original Assignee
China Telecom Cloud Technology 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 China Telecom Cloud Technology Co Ltd filed Critical China Telecom Cloud Technology Co Ltd
Priority to CN202211458621.5A priority Critical patent/CN115914210A/en
Publication of CN115914210A publication Critical patent/CN115914210A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种基于虚拟网络的文件传输方法、装置及系统,涉及数据传输技术领域。该基于虚拟网络的文件传输方法,通过数据转发装置接收来自客户端发送的特定消息格式的数据,数据转发装置转发特定消息格式的数据至云电脑,数据转发装置发送特定消息格式的数据到服务端监听端口,数据转发装置接收特定消息格式的数据写入指定文件。该基于虚拟网络的文件传输方法,将数据传输至转换装置在跨网络的应用场景中,速度较传统的方式带宽损耗较低且有更高的传输速度,不会修改现有的网络环境,非侵入式,兼容性好,基于应用层报文封装与解析,广泛适用于各种操作系统,无需在本地和云电脑之间来回切换窗口,支持批量文件的传输。

Figure 202211458621

The invention discloses a virtual network-based file transmission method, device and system, and relates to the technical field of data transmission. In the virtual network-based file transfer method, the data forwarding device receives data in a specific message format sent from the client, the data forwarding device forwards the data in the specific message format to the cloud computer, and the data forwarding device sends the data in the specific message format to the server The listening port, the data forwarding device receives data in a specific message format and writes it into a designated file. This virtual network-based file transfer method transmits data to the conversion device in a cross-network application scenario. Compared with the traditional method, the bandwidth loss is lower and the transmission speed is higher, and the existing network environment will not be modified. Intrusive, good compatibility, based on application layer message encapsulation and analysis, widely applicable to various operating systems, no need to switch windows back and forth between local and cloud computers, and supports batch file transmission.

Figure 202211458621

Description

一种基于虚拟网络的文件传输方法、装置及系统A virtual network-based file transfer method, device and system

技术领域technical field

本发明涉及数据传输技术领域,具体为一种基于虚拟网络的文件传输方法、装置及系统。The invention relates to the technical field of data transmission, in particular to a virtual network-based file transmission method, device and system.

背景技术Background technique

在云电脑的实际使用过程中,经常会有数据传输的需求,但是云电脑中网络是通过openstack虚拟出来的专用网络,只能通过云电脑内部向外访问互联网,无法通过互联网向云电脑内部传输数据,所以我们无法通过云电脑虚拟出来的IP地址直接访问到这台云电脑,更不可能通过普通的文件传输工具(如SFTP、SCP、SSH等)上传文件到云电脑,实现传输文件到云电脑现有的方案是通过云电脑客户端与云电脑镜像中的底层通讯服务端口(虚拟化进程端口)交互进行数据转发,能实现本地计算机发送数据到云电脑。In the actual use of cloud computers, there is often a need for data transmission, but the network in the cloud computer is a private network virtualized by openstack, which can only access the Internet through the cloud computer, and cannot transmit to the cloud computer through the Internet. data, so we cannot directly access this cloud computer through the IP address virtualized by the cloud computer, let alone upload files to the cloud computer through ordinary file transfer tools (such as SFTP, SCP, SSH, etc.) to transfer files to the cloud The existing computer solution is to forward data through the interaction between the cloud computer client and the underlying communication service port (virtualization process port) in the cloud computer image, which can realize the local computer sending data to the cloud computer.

但是这种传输方案存在以下问题,首先云电脑客户端虚拟化交互是全屏交互,传输文件需要在本地和虚拟化窗口之间来回切换操作,比较繁琐,传输数据时会占用虚拟化通道,导致虚拟显示操作卡顿,数据量越多占用时间越长,体验效果不佳,传输数据期间同时操作云电脑或者网络的不稳定都可能导致数据传输中断,中断之后需要人工介入执行重传,进而影响使用者的体验。However, this transmission scheme has the following problems. First, the virtualization interaction of the cloud computer client is a full-screen interaction. To transfer files, you need to switch back and forth between the local and virtualization windows, which is cumbersome. The virtualization channel will be occupied when transferring data, resulting in virtualization The display operation is stuck, the more data, the longer it takes, and the experience effect is not good. During the data transmission, the cloud computer is operated at the same time or the network is unstable. The data transmission may be interrupted. After the interruption, manual intervention is required to perform retransmission, which will affect the use. experience.

发明内容Contents of the invention

针对现有技术的不足,本发明提供了一种基于虚拟网络的文件传输方法、装置及系统,解决了传统的云电脑传输文件导致带宽损耗较高以及兼容性差不能进行广泛的应用与各种操作系统,同时实现传输文件操作简单能够批量化进行文件传输的问题。Aiming at the deficiencies of the prior art, the present invention provides a virtual network-based file transfer method, device and system, which solves the problem of high bandwidth loss and poor compatibility caused by traditional cloud computer file transfer, which cannot be widely used and various operations system, and at the same time realize the problem that the file transfer operation is simple and the file transfer can be performed in batches.

为实现以上目的,本发明通过以下技术方案予以实现:一种基于虚拟网络的文件传输方法,其特征在于,包括:In order to achieve the above object, the present invention is achieved through the following technical solutions: a virtual network-based file transfer method, characterized in that it includes:

S1:接收来自客户端发送的特定消息格式的数据;S1: Receive data in a specific message format sent from the client;

S2:转发特定消息格式的数据至云电脑;S2: forward the data of the specific message format to the cloud computer;

S3:发送特定消息格式的数据到服务端监听端口;S3: Send data in a specific message format to the server listening port;

S4:接收特定消息格式的数据写入指定文件。S4: Receive data in a specific message format and write it into a specified file.

进一步地,所述特定消息格式的数据由4位长报文标识头、2位长消息类型、4位长报文长度、4位长报文序号和报文内容组成。Further, the data of the specific message format consists of a 4-digit long message identification header, a 2-digit long message type, a 4-digit long message length, a 4-digit long message sequence number and message content.

进一步地,所述步骤S1中接收来自客户端发送的特定消息格式的数据,其中具体的接收如下:Further, in the step S1, data in a specific message format sent from the client is received, wherein the specific reception is as follows:

客户端根据报文体格式封装渠道创建消息发送到转发装置,转发装置根据消息类型解析消息体,提取消息体中会话ID,建立Socket长连接,并存储当前长连接渠道ID到内存中;The client creates a message according to the message body format encapsulation channel and sends it to the forwarding device. The forwarding device parses the message body according to the message type, extracts the session ID in the message body, establishes a Socket persistent connection, and stores the current persistent connection channel ID in the memory;

客户端将需要发送的真实数据封装成数据转发消息发送到转发装置,转发装置解析消息类型为转发消息。The client encapsulates the real data to be sent into a data forwarding message and sends it to the forwarding device, and the forwarding device parses the message type as a forwarding message.

进一步地,所述客户端与转发装置建立连接之后,转发装置将客户端的渠道ID与用户标识,用户ID和云电脑ID组合成KV键值对保存在客户端内存对象Map中。Further, after the client establishes a connection with the forwarding device, the forwarding device combines the channel ID of the client with the user identifier, the user ID and the cloud computer ID into a KV key-value pair and saves it in the client memory object Map.

进一步地,所述客户端封装渠道创建消息按照特定消息格式报文结构,设置消息类型为2,消息内容为用户渠道连接认证消息对象JSON序列化字符串,组装完成后发送消息到转发装置,转发装置处理完消息后,返回响应消息CLOSED或ESTABLISHED。Further, the client encapsulates the channel creation message according to the specific message format message structure, sets the message type to 2, and the message content is the JSON serialized string of the user channel connection authentication message object. After the assembly is completed, the message is sent to the forwarding device for forwarding. After the device finishes processing the message, it returns a response message CLOSED or ESTABLISHED.

进一步地,所述服务端封装渠道创建消息按照特定消息格式报文结构,设置消息类型为1,消息内容为用户渠道连接认证消息对象JSON序列化字符串,组装完成后发送消息到转发装置,转发装置处理完消息后,返回响应消息CLOSED或ESTABLISHED。Further, the server encapsulates the channel creation message according to the specific message format message structure, sets the message type to 1, and the message content is the JSON serialized string of the user channel connection authentication message object. After the assembly is completed, the message is sent to the forwarding device for forwarding After the device finishes processing the message, it returns a response message CLOSED or ESTABLISHED.

进一步地,所述步骤S3中发送特定消息格式的数据到服务端,其中具体的发送如下:Further, in the step S3, the data in a specific message format is sent to the server, wherein the specific sending is as follows:

服务端根据报文体格式封装渠道创建消息发送到转发装置,转发装置根据消息类型解析消息体,提取消息体中会话ID,建立Socket长连接,并存储当前长连接渠道ID到内存中。The server creates a message by encapsulating the channel according to the message body format and sends it to the forwarding device. The forwarding device parses the message body according to the message type, extracts the session ID in the message body, establishes a Socket persistent connection, and stores the current persistent connection channel ID in the memory.

进一步地,所述步骤S4中接收特定消息格式的数据写入指定文件,其中具体的写入如下:Further, the data in the specific message format received in the step S4 is written into a specified file, wherein the specific writing is as follows:

转发装置收到消息并解析:按照特定消息格式报文结构,转发装置接收到消息后,由消息解码器读取消息前4位长作为消息来源,只有可信的来源才处理消息;The forwarding device receives the message and parses it: according to the specific message format message structure, after the forwarding device receives the message, the message decoder reads the first 4 digits of the message as the source of the message, and only trusted sources process the message;

转发装置处理认证消息类型:如果消息类型为1或者2,将解析出来的消息内容通过JSON反序列化为用户渠道连接认证消息对象;The forwarding device processes the authentication message type: if the message type is 1 or 2, deserialize the parsed message content into a user channel connection authentication message object through JSON;

转发装置处理转发消息类型:如果消息类型为3,则不再反序列化消息内容,直接根据发送渠道ID智能匹配目的端渠道;The forwarding device processes the forwarded message type: if the message type is 3, the content of the message is no longer deserialized, and the destination channel is intelligently matched directly according to the sending channel ID;

目的端接收数据写入磁盘:目的端接收到转发装置发送的消息后直接写入磁盘,消息处理完毕后主动断开连接,即可完成整个数据文件传输。Destination end receives data and writes it to disk: the destination end receives the message sent by the forwarding device and writes it directly to the disk. After the message is processed, it actively disconnects to complete the entire data file transmission.

一种基于虚拟网络的文件传输系统,包括:A virtual network-based file transfer system, including:

客户端模块、数据转发模块、服务端、客户端识别模块、目标端识别模块、报文数据转发模块、长连接会话保持模块和流量控制模块;A client module, a data forwarding module, a server, a client identification module, a target identification module, a message data forwarding module, a long connection session maintenance module and a flow control module;

所述流量控制模块在对数据接收线程中高水位和低水位进行流量控制,缓冲区中待发送数据高水位后,暂停读取线程工作,直到缓冲区中数据低于低水位后恢复接收线程工作,继续接收消息。The flow control module performs flow control on the high water level and low water level in the data receiving thread, and after the high water level of the data to be sent in the buffer, suspends the reading thread work until the data in the buffer is lower than the low water level and resumes the receiving thread work, Continue to receive messages.

一种基于虚拟网络的文件传输装置,应用于文件传输系统所包括的客户端,所述文件传输系统还包括数据转发装置以及云电脑,所述云电脑包括服务端;包括:A file transfer device based on a virtual network, applied to a client included in a file transfer system, the file transfer system also includes a data forwarding device and a cloud computer, the cloud computer includes a server; including:

发送模块:用于接收来自客户端发送的特定消息格式的数据;Sending module: used to receive data in a specific message format sent from the client;

转发模块:用于转发特定消息格式的数据至云电脑;Forwarding module: used to forward data in a specific message format to the cloud computer;

第二发送模块:用于发送特定消息格式的数据到服务端监听端口;The second sending module: used to send data in a specific message format to the listening port of the server;

接收模块:用于接收特定消息格式的数据写入指定文件。Receiving module: used to receive data in a specific message format and write it into a specified file.

本发明具有以下有益效果:The present invention has the following beneficial effects:

该基于虚拟网络的文件传输方法,将数据传输至转换装置在跨网络的应用场景中,速度较传统的方式带宽损耗较低且有更高的传输速度,不会修改现有的网络环境,非侵入式,兼容性好,基于应用层报文封装与解析,广泛适用于各种操作系统,无需在本地和云电脑之间来回切换窗口,支持批量文件的传输,并且支持文件传输断网重试,在弱网环境优化更突出。The virtual network-based file transfer method transmits data to the conversion device in a cross-network application scenario. Compared with the traditional method, the bandwidth loss is lower and the transmission speed is higher, and the existing network environment will not be modified. Intrusive, good compatibility, based on application layer packet encapsulation and analysis, widely applicable to various operating systems, no need to switch windows back and forth between local and cloud computers, supports batch file transfer, and supports file transfer retry after network disconnection , the optimization is more prominent in the weak network environment.

当然,实施本发明的任一产品并不一定需要同时达到以上所述的所有优点。Of course, any product implementing the present invention does not necessarily need to achieve all the above-mentioned advantages at the same time.

附图说明Description of drawings

图1为本发明文件传输方法流程图;Fig. 1 is a flow chart of the file transmission method of the present invention;

图2为本发明消息报文格式示意图;Fig. 2 is a schematic diagram of the message format of the present invention;

图3为本发明报文交互流程示意图;Fig. 3 is a schematic diagram of message interaction flow in the present invention;

图4为本发明服务端智能匹配流程示意图;Fig. 4 is a schematic diagram of the intelligent matching process at the server end of the present invention;

图5为本发明消息类型解析流程状态示意图;Fig. 5 is a schematic diagram of the status of the message type parsing process of the present invention;

图6为本发明数据转发流程示意图。FIG. 6 is a schematic diagram of a data forwarding process in the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

在本发明的描述中,需要理解的是,术语“开孔”、“上”、“下”、“厚度”、“顶”、“中”、“长度”、“内”、“四周”等指示方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的组件或元件必须具有特定的方位,以特定的方位构造和操作,因此不能理解为对本发明的限制。In describing the present invention, it is to be understood that the terms "opening", "upper", "lower", "thickness", "top", "middle", "length", "inner", "surrounding" etc. Indicating orientation or positional relationship is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the components or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be construed as limiting the present invention .

请参阅图1,本发明实施例提供一种技术方案:一种基于虚拟网络的文件传输方法,包括:Please refer to Fig. 1, the embodiment of the present invention provides a kind of technical scheme: a kind of file transmission method based on virtual network, comprising:

S1:接收来自客户端发送的特定消息格式的数据;S1: Receive data in a specific message format sent from the client;

S2:转发特定消息格式的数据至云电脑;S2: forward the data of the specific message format to the cloud computer;

S3:发送特定消息格式的数据到服务端监听端口;S3: Send data in a specific message format to the server listening port;

S4:接收特定消息格式的数据写入指定文件。S4: Receive data in a specific message format and write it into a specified file.

具体地,如图2所示,特定消息格式的数据由4位长报文标识头、2位长消息类型、4位长报文长度、4位长报文序号和报文内容组成。Specifically, as shown in FIG. 2 , the data of a specific message format consists of a 4-digit long message identification header, a 2-digit long message type, a 4-digit long message length, a 4-digit long message sequence number and message content.

本实施方案中,报文内容由要转发的真实数据报文,根据报文类型解析报文内容,识别客户端和目标端连接会话ID,通过同一个会话ID来匹配客户端和目的端,进行数据转发;类型为数据转发的消息内容直接转发,不需要解析。In this embodiment, the message content is the real data message to be forwarded, the message content is parsed according to the message type, the connection session ID of the client and the target end is identified, and the client and the target end are matched through the same session ID to perform Data forwarding; the content of the message whose type is data forwarding is forwarded directly without parsing.

具体地,如图3所示,步骤S1中接收来自客户端发送的特定消息格式的数据,其中具体的接收如下:Specifically, as shown in Figure 3, in step S1, data in a specific message format sent from the client is received, wherein the specific reception is as follows:

客户端根据报文体格式封装渠道创建消息发送到转发装置,转发装置根据消息类型解析消息体,提取消息体中会话ID,建立Socket长连接,并存储当前长连接渠道ID到内存中;The client creates a message according to the message body format encapsulation channel and sends it to the forwarding device. The forwarding device parses the message body according to the message type, extracts the session ID in the message body, establishes a Socket persistent connection, and stores the current persistent connection channel ID in the memory;

客户端将需要发送的真实数据封装成数据转发消息发送到转发装置。The client encapsulates the real data to be sent into a data forwarding message and sends it to the forwarding device.

本实施方案中,当转发装置解析消息类型为转发消息,则不再解析消息体,通过当前连接的渠道ID获取渠道对应的会话ID,根据会话ID寻址目标端相同会话ID的渠道,寻址到目标端连接渠道后直接转发当前消息到目标渠道,实现消息跨网络转发。In this embodiment, when the forwarding device parses the message type as a forwarded message, it no longer parses the message body, obtains the session ID corresponding to the channel through the currently connected channel ID, addresses the channel with the same session ID at the target end according to the session ID, and addresses After connecting to the target channel, the current message is directly forwarded to the target channel to realize message forwarding across the network.

具体地,步骤S3中发送特定消息格式的数据到服务端,其中具体的发送如下:Specifically, in step S3, send data in a specific message format to the server, wherein the specific sending is as follows:

如图3所示,服务端根据报文体格式封装渠道创建消息发送到转发装置,转发装置根据消息类型解析消息体,提取消息体中会话ID,建立Socket长连接,并存储当前长连接渠道ID到内存中。As shown in Figure 3, the server creates a message based on the message body format encapsulation channel and sends it to the forwarding device. The forwarding device parses the message body according to the message type, extracts the session ID in the message body, establishes a Socket persistent connection, and stores the current persistent connection channel ID in the in memory.

具体地,如图4所示,客户端与转发装置建立连接之后,转发装置将客户端的渠道ID与用户标识,用户ID和云电脑ID组合成KV键值对保存在客户端内存对象Map中。Specifically, as shown in Figure 4, after the client establishes a connection with the forwarding device, the forwarding device combines the channel ID of the client with the user ID, user ID and cloud computer ID into a KV key-value pair and stores it in the client memory object Map.

本实施方案中,如图4所示,客户端请求转发数据时,转发装置通过客户端的连接拿到连接渠道ID,通过渠道ID查找客户端内存对象Map对应渠道ID,如果找到则通过对应的用户标识(用户ID+云电脑ID)在服务端内存对象Map中查找对应用户标识,如果找不到则提示服务端不存在,否则即可获取到服务端渠道ID,进而可以向服务端渠道发送数据,达到自动寻址服务端渠道并转发数据的目的。In this embodiment, as shown in Figure 4, when the client requests to forward data, the forwarding device obtains the connection channel ID through the connection of the client, searches for the channel ID corresponding to the client memory object Map through the channel ID, and if found, passes the corresponding user The ID (user ID + cloud computer ID) searches for the corresponding user ID in the memory object Map of the server. If it is not found, it will prompt that the server does not exist. Otherwise, the channel ID of the server can be obtained, and then data can be sent to the channel of the server. To achieve the purpose of automatically addressing the server channel and forwarding data.

具体地,如图5所示,服务端封装渠道创建消息按照特定消息格式报文结构,设置消息类型为1,消息内容为用户渠道连接认证消息对象JSON序列化字符串,组装完成后发送消息到转发装置(SYN-SENT),转发装置处理完消息后(5.4、5.5)返回响应消息(CLOSED或ESTABLISHED)。Specifically, as shown in Figure 5, the server encapsulates the channel creation message according to the specific message format message structure, sets the message type to 1, and the message content is the JSON serialized string of the user channel connection authentication message object. After the assembly is completed, the message is sent to The forwarding device (SYN-SENT), returns a response message (CLOSED or ESTABLISHED) after the forwarding device processes the message (5.4, 5.5).

具体地,如图5所示,客户端封装渠道创建消息按照特定消息格式报文结构,设置消息类型为2,消息内容为用户渠道连接认证消息对象JSON序列化字符串,组装完成后发送消息到转发装置(SYN-SENT),转发装置处理完消息后(5.4、5.5)返回响应消息(CLOSED或ESTABLISHED)。Specifically, as shown in Figure 5, the client encapsulates the channel creation message according to the specific message format message structure, sets the message type to 2, and the message content is the JSON serialized string of the user channel connection authentication message object. After the assembly is completed, the message is sent to The forwarding device (SYN-SENT), returns a response message (CLOSED or ESTABLISHED) after the forwarding device processes the message (5.4, 5.5).

本实施方案中,如图5所示,客户端数据转发消息按照特定消息格式报文结构,设置消息类型为3,消息内容为用户传输文件的真实数据,读取数据后无需序列化直接按消息格式组装成消息发送到转发装置(SYN-SENT),转发装置异步处理完消息后(5.4、5.6)返回响应消息(CLOSED或ESTABLISHED),客户端发送完消息主动断开连接(FIN_WAIT1)。In this implementation, as shown in Figure 5, the client data forwarding message follows the specific message format message structure, sets the message type to 3, and the message content is the real data of the file transmitted by the user. The format is assembled into a message and sent to the forwarding device (SYN-SENT). The forwarding device returns a response message (CLOSED or ESTABLISHED) after asynchronously processing the message (5.4, 5.6), and the client actively disconnects after sending the message (FIN_WAIT1).

一种基于虚拟网络的文件传输系统,包括:A virtual network-based file transfer system, including:

客户端模块、数据转发模块、服务端、客户端识别模块、目标端识别模块、报文数据转发模块、长连接会话保持模块和流量控制模块;A client module, a data forwarding module, a server, a client identification module, a target identification module, a message data forwarding module, a long connection session maintenance module and a flow control module;

客户端模块主要用来通过互联网登录同步工具进行发送请求到云电脑;The client module is mainly used to log in to the synchronization tool through the Internet to send requests to the cloud computer;

数据转发模块主要用来对客户端和服务端的数据进行识别、创建、转换以及解析;The data forwarding module is mainly used to identify, create, convert and analyze the data of the client and server;

流量控制模块在对数据接收线程中高水位和低水位进行流量控制,缓冲区中待发送数据高水位后,暂停读取线程工作,直到缓冲区中数据低于低水位后恢复接收线程工作,继续接收消息;The flow control module performs flow control on the high water level and low water level in the data receiving thread, and after the high water level of the data to be sent in the buffer, suspends the work of the reading thread until the data in the buffer is lower than the low water level, resumes the work of the receiving thread, and continues to receive information;

目标端识别模块主要用来对转发消息类型进行识别;The target identification module is mainly used to identify the forwarded message type;

服务端主要是根据报文格式封装渠道创建消息发送到数据转发模块;The server mainly creates a message according to the message format encapsulation channel and sends it to the data forwarding module;

报文数据转发模块主要用来对识别不同类型的报文内容进行转发。The message data forwarding module is mainly used to forward the content of different types of message identification.

具体地,步骤S4中接收特定消息格式的数据写入指定文件,其中具体的写入如下:Specifically, in the step S4, the data of the specific message format received is written into the specified file, wherein the specific writing is as follows:

如图5所示,转发装置收到消息并解析:按照特定消息格式报文结构,转发装置接收到消息后(SYN_RCVD),由消息解码器读取消息前4位长作为消息来源,只有可信的来源才处理消息;As shown in Figure 5, the forwarding device receives the message and parses it: according to the specific message format message structure, after the forwarding device receives the message (SYN_RCVD), the message decoder reads the first 4 digits of the message as the source of the message, and only the credible The source only processes the message;

转发装置处理认证消息类型:如果消息类型为1或者2,将解析出来的消息内容通过JSON反序列化为用户渠道连接认证消息对象;The forwarding device processes the authentication message type: if the message type is 1 or 2, deserialize the parsed message content into a user channel connection authentication message object through JSON;

转发装置处理转发消息类型:如果消息类型为3,则不再反序列化消息内容,直接根据发送渠道ID智能匹配目的端渠道;The forwarding device processes the forwarded message type: if the message type is 3, the content of the message is no longer deserialized, and the destination channel is intelligently matched directly according to the sending channel ID;

目的端接收数据写入磁盘:目的端接收到转发装置发送的消息后直接写入磁盘,消息处理完毕后主动断开连接,即可完成整个数据文件传输(FIN_WAIT1)。Destination end receives data and writes it to disk: the destination end receives the message sent by the forwarding device and writes it directly to the disk. After the message is processed, it actively disconnects to complete the entire data file transfer (FIN_WAIT1).

本实施方案中,由消息解码器读取消息前4位长作为消息来源,只有可信的来源才处理消息,继续读取2位长作为消息类型,目前使用到了3种类型(1-目的端连接请求、2-客户端连接请求、3-客户端转发请求),继续根据报文类型读取消息长度、消息序号,根据消息长度读取真实消息;In this embodiment, the first 4 digits of the message are read by the message decoder as the source of the message, and only credible sources process the message, and continue to read the 2 digits as the message type. Currently, 3 types are used (1-destination end Connection request, 2-client connection request, 3-client forwarding request), continue to read the message length and message sequence number according to the message type, and read the real message according to the message length;

通过处理消息对象实现用户渠道合法认证,认证通过的连接允许建立通道(ESTABLISHED),保存渠道长连接到内存中,认证失败的连接则拒绝连接,断开当前连接(CLOSED);Realize legal authentication of the user channel by processing the message object. The authenticated connection is allowed to establish a channel (ESTABLISHED), and the long-term connection of the channel is saved in the memory. The connection that fails the authentication rejects the connection and disconnects the current connection (CLOSED);

如果消息类型为3,则不再反序列化消息内容,直接根据发送渠道ID智能匹配目的端渠道;未寻址到目的端则断开当前连接(CLOSED),寻到到目标端则直接将解析出来的消息内容转发给目的端通道(SYN-SENT)。If the message type is 3, the content of the message will no longer be deserialized, and the destination channel will be intelligently matched directly according to the sending channel ID; if the destination is not addressed, the current connection will be disconnected (CLOSED), and the destination will be parsed directly The outgoing message content is forwarded to the destination channel (SYN-SENT).

一种基于虚拟网络的文件传输装置,包括:A virtual network-based file transfer device, comprising:

发送模块:用于接收来自客户端发送的特定消息格式的数据;Sending module: used to receive data in a specific message format sent from the client;

客户端根据报文体格式封装渠道创建消息发送到转发装置,转发装置根据消息类型解析消息体,提取消息体中会话ID,建立Socket长连接,并存储当前长连接渠道ID到内存中;The client creates a message according to the message body format encapsulation channel and sends it to the forwarding device. The forwarding device parses the message body according to the message type, extracts the session ID in the message body, establishes a Socket persistent connection, and stores the current persistent connection channel ID in the memory;

客户端将需要发送的真实数据封装成数据转发消息发送到转发装置,转发装置解析消息类型为转发消息。The client encapsulates the real data to be sent into a data forwarding message and sends it to the forwarding device, and the forwarding device parses the message type as a forwarding message.

转发模块:用于转发特定消息格式的数据至云电脑;Forwarding module: used to forward data in a specific message format to the cloud computer;

客户端与转发装置建立连接之后,转发装置将客户端的渠道ID与用户标识(用户ID+云电脑ID)组合成KV键值对保存在客户端内存对象Map中。After the client establishes a connection with the forwarding device, the forwarding device combines the client's channel ID and user ID (user ID+cloud computer ID) into a KV key-value pair and stores it in the client memory object Map.

第二发送模块:用于发送特定消息格式的数据到服务端监听端口;The second sending module: used to send data in a specific message format to the listening port of the server;

服务端根据报文体格式封装渠道创建消息发送到转发装置,转发装置根据消息类型解析消息体,提取消息体中会话ID,建立Socket长连接,并存储当前长连接渠道ID到内存中。The server creates a message by encapsulating the channel according to the message body format and sends it to the forwarding device. The forwarding device parses the message body according to the message type, extracts the session ID in the message body, establishes a Socket persistent connection, and stores the current persistent connection channel ID in the memory.

接收模块:用于接收特定消息格式的数据写入指定文件。Receiving module: used to receive data in a specific message format and write it into a specified file.

目的端接收到转发装置发送的消息后直接写入磁盘,消息处理完毕后主动断开连接,即可完成整个数据文件传输(FIN_WAIT1)。After receiving the message sent by the forwarding device, the destination end directly writes it to the disk, and actively disconnects after the message is processed to complete the entire data file transfer (FIN_WAIT1).

使用时,如图6所示,首先客户端通过互联网登录同步工具,同步工具发送请求到云电脑业务管理平台,验证用户信息,获取云电脑信息列表,当登录成功后注册同步服务到管理节点,获取历史同步任务,未完成且同步中状态的任务自动启动,继续断点续传,调用业管接口服务发送信令到对应云电脑,选择要传输文件到指定的台云电脑,然后通过云电脑机制通知云电脑启动传输服务端,当服务端所在云电脑如果有外网访问能力,则直接通过外网注册到管理节点,如果没有外网能力,则通过100.64.3.254代理节点转发请求到管理节点,注册并建立长连接,客户端刷新云电脑在线状态,获取目录结构,当需要传输文件时先启动服务端传输服务,如果云电脑有外网能力,则直接通过外网连接到同步节点,如果没有外网能力,则通过100.64.3.254代理节点转发请求到同步节点,建立长连接,当服务端传输服务启动后,客户端通过公网与同步节点建立长连接,发送传输数据到同步节点,由同步节点自动匹配服务端通道将客户端数据转发到服务端,完成数据跨网段同步,此时服务端传输服务收到来自同步节点的数据后,将数据写入到本地同路径的文件中,完成数据文件的整个传输流程。When in use, as shown in Figure 6, first, the client logs in to the synchronization tool through the Internet, and the synchronization tool sends a request to the cloud computer business management platform to verify user information and obtain a list of cloud computer information. After successful login, register the synchronization service to the management node. Obtain historical synchronization tasks, tasks that have not been completed and are in the state of synchronization are automatically started, continue to resume the breakpoint, call the industry management interface service to send signaling to the corresponding cloud computer, select the file to be transferred to the designated Taiyun computer, and then pass the cloud computer The mechanism notifies the cloud computer to start the transmission server. If the cloud computer where the server is located has the ability to access the external network, it will directly register with the management node through the external network. If it does not have the external network capability, it will forward the request to the management node through the 100.64.3.254 proxy node , register and establish a long-term connection, the client refreshes the online status of the cloud computer, obtains the directory structure, and starts the server-side transmission service when transferring files. If the cloud computer has external network capabilities, it directly connects to the synchronization node through the external network. If If there is no external network capability, the proxy node forwards the request to the synchronization node through 100.64.3.254, and establishes a long connection. When the server transmission service starts, the client establishes a long connection with the synchronization node through the public network, and sends the transmission data to the synchronization node. The synchronization node automatically matches the server channel to forward the client data to the server to complete data synchronization across network segments. At this time, after the server transmission service receives the data from the synchronization node, it writes the data into a local file with the same path. Complete the entire transfer process of the data file.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device.

以上公开的本发明优选实施例只是用于帮助阐述本发明。优选实施例并没有详尽叙述所有的细节,也不限制该发明仅为所述的具体实施方式。显然,根据本说明书的内容,可作很多的修改和变化。本说明书选取并具体描述这些实施例,是为了更好地解释本发明的原理和实际应用,从而使所属技术领域技术人员能很好地理解和利用本发明。本发明仅受权利要求书及其全部范围和等效物的限制。The preferred embodiments of the invention disclosed above are only to help illustrate the invention. The preferred embodiments are not exhaustive in all detail, nor are the inventions limited to specific embodiments described. Obviously, many modifications and variations can be made based on the contents of this specification. This description selects and specifically describes these embodiments in order to better explain the principle and practical application of the present invention, so that those skilled in the art can well understand and utilize the present invention. The invention is to be limited only by the claims, along with their full scope and equivalents.

Claims (10)

1. A file transmission method based on a virtual network is characterized by comprising the following steps:
s1, receiving data in a specific message format sent by a client;
s2, forwarding the data in the specific message format to a cloud computer;
s3, sending data in a specific message format to a server monitoring port;
and S4, receiving data in a specific message format and writing the data into a specified file.
2. The file transmission method based on the virtual network according to claim 1, wherein: the data of the specific message format consists of a 4-bit length message identification head, a 2-bit length message type, a 4-bit length message length, a 4-bit length message sequence number and message contents.
3. The file transmission method based on the virtual network as claimed in claim 1, wherein: in step S1, data in a specific message format sent from the client is received, where the specific receiving is as follows:
the client packages the channel establishment message according to the message body format and sends the message to the forwarding device, the forwarding device analyzes the message body according to the message type, extracts the session ID in the message body, establishes Socket long connection and stores the current long connection channel ID into the memory;
the client encapsulates real data to be sent into a data forwarding message and sends the data forwarding message to the forwarding device, and the forwarding device analyzes the message type into the forwarding message.
4. The file transmission method based on the virtual network according to claim 3, wherein: after the client is connected with the forwarding device, the forwarding device stores the channel ID and the user identification of the client, and the KV key value pair synthesized by the user ID and the cloud computer ID in the memory object Map of the client.
5. The file transmission method based on the virtual network as claimed in claim 3, wherein: the client side packaging channel creating message sets the message type to be 2 according to a specific message format message structure, the message content is a JSON serialized character string of a user channel connection authentication message object, the message is sent to a forwarding device after the assembly is completed, and the forwarding device returns a response message CLOSED or ESTABISHED after the message is processed.
6. The file transmission method based on the virtual network as claimed in claim 4, wherein: the server side packaging channel creation message sets the message type to be 1 according to a specific message format message structure, the message content is a JSON serialized character string of a user channel connection authentication message object, the message is sent to a forwarding device after the assembly is completed, and the forwarding device returns a response message CLOSED or ESTABLECHED after the message is processed.
7. The file transmission method based on the virtual network according to claim 1, wherein: in step S3, data in a specific message format is sent to the server, where the specific sending is as follows:
the server side creates a message according to the message format encapsulation channel and sends the message to the forwarding device, the forwarding device analyzes the message body according to the message type, the session ID in the message body is extracted, the Socket long connection is established, and the current long connection channel ID is stored in the memory.
8. The file transmission method based on the virtual network as claimed in claim 1, wherein: in step S4, the data write-in specified file in the specific message format is received, where the specific write-in is as follows:
the forwarding device receives and analyzes the message: according to a message structure with a specific message format, after a forwarding device receives a message, a message decoder reads the front 4 bits of the message as a message source, and only a credible source processes the message;
the forwarding device processes the authentication message type: if the message type is 1 or 2, deserializing the analyzed message content into a user channel connection authentication message object through JSON;
the forwarding device processes the forwarding message type: if the message type is 3, the message content is not deserialized, and the destination end channel is intelligently matched directly according to the ID of the sending channel;
the destination receives data and writes into the disk: the target end receives the message sent by the forwarding device and then directly writes the message into the disk, and the connection is actively disconnected after the message is processed, so that the whole data file transmission can be completed.
9. A file transfer system based on a virtual network, comprising:
the system comprises a client module, a data forwarding module, a server, a client identification module, a target identification module, a message data forwarding module, a long connection session holding module and a flow control module;
the flow control module controls the high water level and the low water level in the data receiving thread, suspends the work of the reading thread after the high water level of the data to be sent in the buffer area, resumes the work of the receiving thread until the data in the buffer area is lower than the low water level, and continues to receive the message.
10. A file transfer apparatus based on a virtual network, comprising:
a sending module: the system comprises a client, a server and a server, wherein the client is used for receiving data in a specific message format sent by the client;
a forwarding module: the data forwarding device is used for forwarding data in a specific message format to the cloud computer;
a second sending module: the monitoring port is used for sending data in a specific message format to the server side;
a receiving module: for receiving data written in a specific message format.
CN202211458621.5A 2022-11-17 2022-11-17 File transmission method, device and system based on virtual network Pending CN115914210A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211458621.5A CN115914210A (en) 2022-11-17 2022-11-17 File transmission method, device and system based on virtual network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211458621.5A CN115914210A (en) 2022-11-17 2022-11-17 File transmission method, device and system based on virtual network

Publications (1)

Publication Number Publication Date
CN115914210A true CN115914210A (en) 2023-04-04

Family

ID=86483633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211458621.5A Pending CN115914210A (en) 2022-11-17 2022-11-17 File transmission method, device and system based on virtual network

Country Status (1)

Country Link
CN (1) CN115914210A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119402551A (en) * 2024-11-12 2025-02-07 中移(苏州)软件技术有限公司 Data transmission method, device, equipment, readable storage medium and program product

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108512943A (en) * 2018-05-07 2018-09-07 苏州德姆斯信息技术有限公司 Embedded device data store system based on message queue and store method
CN112968963A (en) * 2021-02-23 2021-06-15 上海昊沧系统控制技术有限责任公司 WebSocket-based method for user forced real-time offline
CN113542402A (en) * 2021-07-13 2021-10-22 奇安信科技集团股份有限公司 File transmission method, device, system, electronic device and storage medium
CN113905040A (en) * 2021-09-30 2022-01-07 北京百度网讯科技有限公司 File transmission method, device, system, equipment and storage medium
CN114053689A (en) * 2020-08-05 2022-02-18 厦门雅基软件有限公司 Service scheduling method, device, equipment and storage medium for cloud game
CN114327340A (en) * 2021-12-30 2022-04-12 联想(北京)有限公司 Control method and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108512943A (en) * 2018-05-07 2018-09-07 苏州德姆斯信息技术有限公司 Embedded device data store system based on message queue and store method
CN114053689A (en) * 2020-08-05 2022-02-18 厦门雅基软件有限公司 Service scheduling method, device, equipment and storage medium for cloud game
CN112968963A (en) * 2021-02-23 2021-06-15 上海昊沧系统控制技术有限责任公司 WebSocket-based method for user forced real-time offline
CN113542402A (en) * 2021-07-13 2021-10-22 奇安信科技集团股份有限公司 File transmission method, device, system, electronic device and storage medium
CN113905040A (en) * 2021-09-30 2022-01-07 北京百度网讯科技有限公司 File transmission method, device, system, equipment and storage medium
CN114327340A (en) * 2021-12-30 2022-04-12 联想(北京)有限公司 Control method and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119402551A (en) * 2024-11-12 2025-02-07 中移(苏州)软件技术有限公司 Data transmission method, device, equipment, readable storage medium and program product

Similar Documents

Publication Publication Date Title
CN114124929B (en) Cross-network data processing methods and devices
CA2509404C (en) Using direct memory access for performing database operations between two or more machines
US5931913A (en) Methods, system and computer program products for establishing a session between a host and a terminal using a reduced protocol
US7761588B2 (en) System and article of manufacture for enabling communication between nodes
US20190266124A1 (en) Methods for enabling direct memory access (dma) capable devices for remote dma (rdma) usage and devices thereof
US7200641B1 (en) Method and system for encoding SCSI requests for transmission using TCP/IP
CN114500633B (en) Data forwarding method, related device, program product and data transmission system
EP3211852A1 (en) Ssh protocol-based session parsing method and system
CN108200158B (en) request transmission system, method, device and storage medium
US10609125B2 (en) Method and system for transmitting communication data
CN111405018B (en) File transmission method and device, electronic equipment and storage medium
CN101599991A (en) A method of improving network file system performance based on high-speed communication protocol
US8396981B1 (en) Gateway for connecting storage clients and storage servers
CN108200018B (en) Flow forwarding method and equipment, computer equipment and readable medium in cloud computing
US20250311024A1 (en) Data processing method and apparatus, related device, and storage medium
CN115134553A (en) Data transmission method and device, electronic equipment and storage medium
US20060015655A1 (en) Method and system for supporting read operations with CRC for iSCSI and iSCSI chimney
CN114710560A (en) Data processing method, system, proxy device, and terminal device
CN114710568B (en) Audio and video data communication methods, equipment and storage media
CN112887420B (en) Message pushing method and device, computer readable storage medium and electronic equipment
CN107528923B (en) A kind of data transmission method of network adapter and network adapter
CN116015892B (en) A method for intranet remote desktop access based on private encryption protocol traffic proxy
CN115914210A (en) File transmission method, device and system based on virtual network
KR100597405B1 (en) Data relay system and data relay method using socket application program
US20220141320A1 (en) Storage interface command packets over fibre channel with transport and network headers as payloads

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