[go: up one dir, main page]

CN117201510A - File synchronization method, device, equipment and storage medium - Google Patents

File synchronization method, device, equipment and storage medium Download PDF

Info

Publication number
CN117201510A
CN117201510A CN202210605613.2A CN202210605613A CN117201510A CN 117201510 A CN117201510 A CN 117201510A CN 202210605613 A CN202210605613 A CN 202210605613A CN 117201510 A CN117201510 A CN 117201510A
Authority
CN
China
Prior art keywords
synchronized
file
information
synchronization
subnet
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
CN202210605613.2A
Other languages
Chinese (zh)
Other versions
CN117201510B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202210605613.2A priority Critical patent/CN117201510B/en
Priority to PCT/CN2023/095772 priority patent/WO2023231836A1/en
Publication of CN117201510A publication Critical patent/CN117201510A/en
Application granted granted Critical
Publication of CN117201510B publication Critical patent/CN117201510B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供的一种文件同步方法、装置、设备及存储介质,所述方法应用于第一设备,包括:获取待同步设备的子网信息及待同步的文件信息;获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息确定是否存在第二设备的子网信息及已完成同步的文件信息。其中,第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同;同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息。若存在,则向第二设备发送同步控制指令;同步控制指令用于指示第二设备向待同步设备传输待同步文件。这样一来,可以提高文件同步的效率。

Embodiments of the present application provide a file synchronization method, device, equipment and storage medium. The method is applied to a first device and includes: obtaining subnet information of the device to be synchronized and file information to be synchronized; and obtaining records of synchronized files. information, and determine whether there is subnet information of the second device and file information that has been synchronized based on the subnet information of the device to be synchronized and the file information to be synchronized in the synchronization file. Among them, the subnet information of the second device and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized; the record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization. and file information that has been synchronized. If it exists, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. In this way, the efficiency of file synchronization can be improved.

Description

一种文件同步方法、装置、设备及存储介质A file synchronization method, device, equipment and storage medium

技术领域Technical field

本申请涉及数据同步技术领域,具体地涉及一种文件同步方法、装置、设备及存储介质。The present application relates to the field of data synchronization technology, and specifically to a file synchronization method, device, equipment and storage medium.

背景技术Background technique

目前,在煤矿工业领域,通过集控中心设备对多种煤矿开采所需的设备进行管理。以液压支架设备为例,液压支架设备是以液压为动力实现升降、前移等运动,进行顶板支护的设备,是煤矿综合机械化开采的关键设备,对现代煤矿生产意义重大。在液压支架设备的使用过程中,集控中心设备可以向多台液压支架设备同步文件,例如,当开发出液压支架设备的软件升级包或者需要对液压支架设备进行模型配置时,集控中心设备需要向多台液压支架设备发送软件升级包或者模型配置文件,以实现对多台液压支架设备的升级和配置,当然,集控中心设备还可以向液压支架设备同步其他文件。其中,对于多台相同型号的液压支架设备来说,需同步的文件相同。Currently, in the field of coal mining industry, various equipment required for coal mining are managed through centralized control center equipment. Take hydraulic support equipment as an example. Hydraulic support equipment is a device that uses hydraulic pressure to achieve lifting, forward movement, etc., and perform roof support. It is a key equipment for comprehensive mechanized mining of coal mines and is of great significance to modern coal mine production. During the use of hydraulic support equipment, the centralized control center equipment can synchronize files to multiple hydraulic support equipment. For example, when a software upgrade package for the hydraulic support equipment is developed or model configuration of the hydraulic support equipment needs to be performed, the centralized control center equipment It is necessary to send software upgrade packages or model configuration files to multiple hydraulic support equipment to realize the upgrade and configuration of multiple hydraulic support equipment. Of course, the centralized control center equipment can also synchronize other files to the hydraulic support equipment. Among them, for multiple hydraulic support equipment of the same model, the files that need to be synchronized are the same.

现有技术中,煤矿工业组网中包含多个子网,通常情况下集控中心设备与多台液压支架设备处于不同的子网中,例如,集控中心设备处于子网1中、多台液压支架设备处于子网2中。因此,集控中心设备在向液压支架设备同步文件时,需要分别向多台液压支架设备进行跨子网传输需同步的文件。而在跨子网传输需同步的文件过程中,传输的数据包(需同步的文件)需要经过多个路由节点,每经过一个路由节点,该路由节点都需要对传输的数据包进行处理,例如寻址、数据封装和数据解封装等,因此跨子网传输需同步的文件需要耗费的时间较长、效率较低。并且,当集控中心设备需要向多个液压支架设备同步同一份文件时,集控中心设备需要向每台液压支架设备分别发送需同步的文件,导致集控中心设备的负载较大,进一步增加了文件同步的耗时,降低文件同步的效率。In the existing technology, the coal mine industrial network contains multiple subnets. Usually, the centralized control center equipment and multiple hydraulic support equipment are in different subnets. For example, the centralized control center equipment is in subnet 1, and multiple hydraulic support equipment are in subnet 1. The rack device is in subnet 2. Therefore, when the centralized control center equipment synchronizes files to the hydraulic support equipment, it needs to transmit the files that need to be synchronized across subnets to multiple hydraulic support equipment. In the process of transferring files that need to be synchronized across subnets, the transferred data packets (files that need to be synchronized) need to pass through multiple routing nodes. Each time they pass through a routing node, the routing node needs to process the transmitted data packets, for example addressing, data encapsulation and data decapsulation, etc., so transferring files that need to be synchronized across subnets takes a long time and is inefficient. Moreover, when the centralized control center equipment needs to synchronize the same file to multiple hydraulic support equipment, the centralized control center equipment needs to send the files that need to be synchronized to each hydraulic support equipment, resulting in a larger load on the centralized control center equipment, further increasing This reduces the time required for file synchronization and reduces the efficiency of file synchronization.

发明内容Contents of the invention

有鉴于此,本申请提供一种文件同步方法、装置、设备及存储介质,以利于解决现有技术中文件同步效率低的问题。In view of this, the present application provides a file synchronization method, device, equipment and storage medium to help solve the problem of low file synchronization efficiency in the prior art.

第一方面,本申请实施例提供了一种文件同步方法,应用于第一设备,所述方法包括:In a first aspect, embodiments of the present application provide a file synchronization method, which is applied to a first device. The method includes:

获取待同步设备的子网信息及待同步的文件信息;Obtain the subnet information of the device to be synchronized and the file information to be synchronized;

获取同步文件的记录信息,并根据所述待同步设备的子网信息及待同步的文件信息在所述同步文件的记录信息确定是否存在第二设备的子网信息及已完成同步的文件信息;其中,所述第二设备的子网信息及已完成同步的文件信息与所述待同步设备的子网信息及待同步的文件信息相同;所述同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息;Obtain the record information of the synchronization file, and determine whether there is the subnet information of the second device and the file information that has been synchronized based on the subnet information of the device to be synchronized and the file information to be synchronized in the synchronization file; Wherein, the subnet information and synchronized file information of the second device are the same as the subnet information and file information to be synchronized of the device to be synchronized; the record information of the synchronized file is used to record the completed file synchronization. The subnet information of the device and the file information that has been synchronized;

若存在,则向所述第二设备发送同步控制指令;所述同步控制指令用于指示所述第二设备向所述待同步设备传输待同步文件。If there is, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.

第一方面一种可能的实现方式,还包括:A possible implementation method for the first aspect also includes:

接收所述第二设备返回的同步完成响应消息;Receive a synchronization completion response message returned by the second device;

根据所述待同步设备的子网信息及待同步的文件信息,更新所述同步文件的记录信息。The record information of the synchronized file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized.

在第一方面的一种可能的实现方式中,在所述获取待同步设备的子网信息及待同步的文件信息之前,还包括:In a possible implementation of the first aspect, before obtaining the subnet information of the device to be synchronized and the file information to be synchronized, the method further includes:

接收所述待同步设备发送的同步文件请求消息;所述同步文件请求消息中携带有子网信息及待同步的文件信息;Receive a synchronization file request message sent by the device to be synchronized; the synchronization file request message carries subnet information and file information to be synchronized;

向所述待同步设备发送同步文件响应消息;Send a synchronization file response message to the device to be synchronized;

所述获取待同步设备的子网信息及待同步的文件信息包括:The obtaining the subnet information of the device to be synchronized and the file information to be synchronized includes:

从所述同步文件请求消息中获取待同步设备的子网信息及待同步的文件信息。Obtain the subnet information of the device to be synchronized and the file information to be synchronized from the synchronization file request message.

优选地,所述同步文件请求消息还携带有待同步设备的文件传输端口信息;文件传输端口信息用于指示所述待同步设备进行文件传输时使用的端口。Preferably, the synchronization file request message also carries file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized for file transmission.

第一方面一种可能的实现方式,在所述向所述第二设备发送同步控制指令之前,还包括:A possible implementation manner of the first aspect, before sending the synchronization control instruction to the second device, further includes:

向所述待同步设备发送同步文件通知消息;Send a synchronization file notification message to the device to be synchronized;

接收所述待同步设备发送的同步文件响应消息,所述同步文件响应消息中携带有所述待同步设备的文件传输端口信息。Receive a synchronization file response message sent by the device to be synchronized, where the synchronization file response message carries file transfer port information of the device to be synchronized.

第一方面一种可能的实现方式,所述同步控制指令中携带有所述待同步设备的文件传输端口信息。In a possible implementation manner of the first aspect, the synchronization control instruction carries file transfer port information of the device to be synchronized.

第一方面一种可能的实现方式,若存在,则向所述第二设备发送同步控制指令包括:A possible implementation of the first aspect, if it exists, sending a synchronization control instruction to the second device includes:

若存在,且存在至少两个第二设备的子网信息及已完成同步的文件信息与所述待同步设备的子网信息及待同步的文件信息相同,则获取所述至少两个第二设备的负载信息;If there is, and there are at least two second devices whose subnet information and synchronized file information are the same as the subnet information and file information to be synchronized of the device to be synchronized, obtain the at least two second devices. load information;

根据所述至少两个第二设备的负载信息,确定目标第二设备,向所述目标第二设备发送同步控制指令。Determine a target second device according to the load information of the at least two second devices, and send a synchronization control instruction to the target second device.

第一方面一种可能的实现方式,所述待同步设备包括至少两个;In a possible implementation of the first aspect, the devices to be synchronized include at least two;

所述根据所述至少两个第二设备的负载信息,确定目标第二设备包括:Determining the target second device based on the load information of the at least two second devices includes:

针对至少两个待同步设备中的每个待同步设备,根据所述至少两个第二设备的负载信息,确定每个待同步设备对应的目标第二设备。For each device to be synchronized among the at least two devices to be synchronized, a target second device corresponding to each device to be synchronized is determined based on the load information of the at least two second devices.

第一方面一种可能的实现方式,所述第一设备与所述待同步设备所属子网不同。In a possible implementation manner of the first aspect, the first device and the device to be synchronized belong to different subnets.

第一方面一种可能的实现方式,还包括:A possible implementation method for the first aspect also includes:

若不存在,则根据所述待同步的文件信息获取待同步文件,并向所述待同步设备发送所述待同步文件;If it does not exist, obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized;

根据所述待同步设备的子网信息及待同步的文件信息,更新所述同步文件的记录信息。The record information of the synchronized file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized.

第二方面,本申请实施例提供了一种文件同步方法,应用于第二设备,所述方法包括:In a second aspect, embodiments of the present application provide a file synchronization method, applied to a second device, and the method includes:

接收同步控制指令;所述同步控制指令用于指示所述第二设备向待同步设备传输待同步文件;Receive a synchronization control instruction; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized;

根据所述同步控制指令,确定待同步的文件信息及待同步设备;According to the synchronization control instruction, determine the file information to be synchronized and the device to be synchronized;

根据所述待同步的文件信息获取待同步文件,并向所述待同步设备发送所述待同步文件。Obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.

第二方面一种可能的实现方式,还包括:A possible implementation method for the second aspect also includes:

向第一设备发送同步完成响应消息。Send a synchronization completion response message to the first device.

第二方面一种可能的实现方式,所述同步控制指令中携带有待同步设备的文件传输端口信息;所述文件传输端口信息用于指示所述待同步设备进行文件传输时使用的端口;In a possible implementation of the second aspect, the synchronization control instruction carries file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized for file transmission;

所述向所述待同步设备发送所述待同步文件包括:Sending the file to be synchronized to the device to be synchronized includes:

通过所述文件传输端口信息指示的端口向所述待同步设备发送所述待同步文件。Send the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information.

第三方面,本申请实施例提供了一种文件同步方法,包括:In the third aspect, embodiments of the present application provide a file synchronization method, including:

接收待同步文件;Receive files to be synchronized;

根据所述待同步文件,更新相应的文件。Update the corresponding file according to the file to be synchronized.

第三方面一种可能的实现方式,在所述接收待同步文件之前,还包括:A possible implementation of the third aspect, before receiving the file to be synchronized, also includes:

向第一设备发送同步文件请求消息;所述同步文件请求消息中携带有子网信息及待同步的文件信息;Send a synchronization file request message to the first device; the synchronization file request message carries subnet information and file information to be synchronized;

接收所述第一设备发送的同步文件响应消息。Receive a synchronization file response message sent by the first device.

第三方面一种可能的实现方式,所述同步文件请求消息中还携带有待同步设备的文件传输端口信息;文件传输端口信息用于指示所述待同步设备进行文件传输时使用的端口。In a possible implementation of the third aspect, the synchronization file request message also carries file transfer port information of the device to be synchronized; the file transfer port information is used to indicate the port used by the device to be synchronized for file transmission.

第三方面一种可能的实现方式,在所述接收待同步文件之前,还包括:A possible implementation of the third aspect, before receiving the file to be synchronized, also includes:

接收所述第一设备发送的同步文件通知消息;Receive a synchronization file notification message sent by the first device;

向所述第一设备发送同步文件响应消息,所述同步文件响应消息中携带有所述待同步设备的文件传输端口信息。Send a synchronization file response message to the first device, where the synchronization file response message carries file transfer port information of the device to be synchronized.

第三方面一种可能的实现方式,所述接收待同步文件包括:In a possible implementation of the third aspect, receiving files to be synchronized includes:

通过所述文件传输端口信息指示的端口接收待同步文件。The file to be synchronized is received through the port indicated by the file transfer port information.

第四方面,本申请实施例提供了一种文件同步装置,包括:In the fourth aspect, embodiments of the present application provide a file synchronization device, including:

获取单元,用于获取待同步设备的子网信息及待同步的文件信息;The acquisition unit is used to obtain the subnet information of the device to be synchronized and the file information to be synchronized;

处理单元,用于获取同步文件的记录信息,并根据所述待同步设备的子网信息及待同步的文件信息在所述同步文件的记录信息确定是否存在第二设备的子网信息及已完成同步的文件信息;其中,所述第二设备的子网信息及已完成同步的文件信息与所述待同步设备的子网信息及待同步的文件信息相同;所述同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息;A processing unit configured to obtain the record information of the synchronization file, and determine whether the subnet information of the second device exists and has been completed based on the subnet information of the device to be synchronized and the file information to be synchronized in the synchronization file. Synchronized file information; wherein the subnet information of the second device and the synchronized file information are the same as the subnet information of the device to be synchronized and the file information to be synchronized; the record information of the synchronized file is used for Record the subnet information of the device that has completed file synchronization and the file information that has completed synchronization;

所述处理单元,还用于,若存在,则向所述第二设备发送同步控制指令;所述同步控制指令用于指示所述第二设备向所述待同步设备传输待同步文件。The processing unit is further configured to, if present, send a synchronization control instruction to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.

第四方面一种可能的实现方式,所述文件同步装置还包括:In a possible implementation of the fourth aspect, the file synchronization device further includes:

接收单元,用于接收所述第二设备返回的同步完成响应消息;A receiving unit configured to receive a synchronization completion response message returned by the second device;

所述处理单元,还用于根据所述待同步设备的子网信息及待同步的文件信息,更新所述同步文件的记录信息。The processing unit is also configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.

第四方面一种可能的实现方式,所述接收单元,还用于接收所述待同步设备发送的同步文件请求消息;所述同步文件请求消息中携带有子网信息及待同步的文件信息;In a possible implementation of the fourth aspect, the receiving unit is further configured to receive a synchronization file request message sent by the device to be synchronized; the synchronization file request message carries subnet information and file information to be synchronized;

所述处理单元,还用于向所述待同步设备发送同步文件响应消息;The processing unit is also configured to send a synchronization file response message to the device to be synchronized;

所述获取单元,具体用于从所述同步文件请求消息中获取待同步设备的子网信息及待同步的文件信息。The obtaining unit is specifically configured to obtain the subnet information of the device to be synchronized and the file information to be synchronized from the synchronization file request message.

第四方面一种可能的实现方式,所述处理单元,还用于向所述待同步设备发送同步文件通知消息;In a possible implementation of the fourth aspect, the processing unit is further configured to send a synchronization file notification message to the device to be synchronized;

所述接收单元,还用于接收所述待同步设备发送的同步文件响应消息;所述同步文件响应消息中携带有所述待同步设备的文件传输端口信息。The receiving unit is also configured to receive a synchronization file response message sent by the device to be synchronized; the synchronization file response message carries the file transmission port information of the device to be synchronized.

第四方面一种可能的实现方式,所述处理单元,具体用于若存在,且存在至少两个第二设备的子网信息及已完成同步的文件信息与所述待同步设备的子网信息及待同步的文件信息相同,则获取所述至少两个第二设备的负载信息;In a possible implementation of the fourth aspect, the processing unit is specifically configured to, if there is one, subnet information of at least two second devices and file information that has been synchronized and subnet information of the device to be synchronized. and the file information to be synchronized are the same, then obtain the load information of the at least two second devices;

根据所述至少两个第二设备的负载信息,确定目标第二设备,向所述目标第二设备发送同步控制指令。Determine a target second device according to the load information of the at least two second devices, and send a synchronization control instruction to the target second device.

第四方面一种可能的实现方式,所述处理单元,具体用于针对至少两个待同步设备中的每个待同步设备,根据所述至少两个第二设备的负载信息,确定每个待同步设备对应的目标第二设备。In a possible implementation of the fourth aspect, the processing unit is specifically configured to determine, for each of the at least two devices to be synchronized, based on the load information of the at least two second devices, each device to be synchronized. The target second device corresponding to the synchronization device.

第四方面一种可能的实现方式,所述处理单元,还用于若不存在,则根据所述待同步的文件信息获取待同步文件,并向所述待同步设备发送所述待同步文件;In a possible implementation of the fourth aspect, the processing unit is further configured to, if it does not exist, obtain the file to be synchronized based on the file information to be synchronized, and send the file to be synchronized to the device to be synchronized;

所述处理单元,还用于根据所述待同步设备的子网信息及待同步的文件信息,更新所述同步文件的记录信息。The processing unit is also configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.

第五方面,本申请实施例提供了一种文件同步装置,包括:In the fifth aspect, embodiments of the present application provide a file synchronization device, including:

接收单元,用于接收同步控制指令;所述同步控制指令用于指示所述第二设备向待同步设备传输待同步文件;A receiving unit, configured to receive a synchronization control instruction; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized;

处理单元,用于根据所述同步控制指令,确定待同步的文件信息及待同步设备;A processing unit, configured to determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction;

所述处理单元,还用于根据所述待同步的文件信息获取待同步文件,并向所述待同步设备发送所述待同步文件。The processing unit is also configured to obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.

所述处理单元,还用于向第一设备发送同步完成响应消息。The processing unit is also configured to send a synchronization completion response message to the first device.

第五方面一种可能的实现方式,所述处理单元,具体用于通过所述文件传输端口信息指示的端口向所述待同步设备发送所述待同步文件。In a possible implementation manner of the fifth aspect, the processing unit is specifically configured to send the file to be synchronized to the device to be synchronized through a port indicated by the file transfer port information.

第六方面,本申请实施例提供了一种文件同步装置,包括:In a sixth aspect, embodiments of the present application provide a file synchronization device, including:

接收单元,用于接收待同步文件;The receiving unit is used to receive files to be synchronized;

处理单元,用于根据所述待同步文件,更新相应的文件。A processing unit, configured to update corresponding files according to the files to be synchronized.

第六方面一种可能的实现方式,所述处理单元,还用于向第一设备发送同步文件请求消息;所述同步文件请求消息中携带有子网信息及待同步的文件信息;In a possible implementation of the sixth aspect, the processing unit is further configured to send a synchronization file request message to the first device; the synchronization file request message carries subnet information and file information to be synchronized;

所述接收单元,还用于接收所述第一设备发送的同步文件响应消息。The receiving unit is also configured to receive a synchronization file response message sent by the first device.

第六方面一种可能的实现方式,所述接收单元,还用于接收所述第一设备发送的同步文件通知消息;In a possible implementation of the sixth aspect, the receiving unit is further configured to receive a synchronization file notification message sent by the first device;

所述处理单元,还用于向所述第一设备发送同步文件响应消息,所述同步文件响应消息中携带有所述待同步设备的文件传输端口信息。The processing unit is further configured to send a synchronization file response message to the first device, where the synchronization file response message carries file transfer port information of the device to be synchronized.

第六方面一种可能的实现方式,所述处理单元,具体用于通过所述文件传输端口信息指示的端口接收待同步文件。In a possible implementation manner of the sixth aspect, the processing unit is specifically configured to receive the file to be synchronized through the port indicated by the file transfer port information.

第七方面,本申请实施例提供了一种电子设备,包括:In a seventh aspect, embodiments of the present application provide an electronic device, including:

处理器和存储器,所述存储器存储有计算机程序,当所述计算机程序被执行时,使得所述电子设备执行上述第一方面任一项或第二方面任一项或第三方面任一项所述的方法。A processor and a memory. The memory stores a computer program. When the computer program is executed, the electronic device causes the electronic device to execute any one of the first aspect, any one of the second aspect, or any one of the third aspect. method described.

第八方面,本申请实施例提供了一种存储介质,所述存储介质包括存储的程序,其中,在所述程序运行时控制所述存储介质所在设备执行上述第一方面任一项或第二方面任一项或第三方面任一项所述的方法。In an eighth aspect, embodiments of the present application provide a storage medium. The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute any one of the first aspect or the second aspect. The method described in any one of the aspects or any one of the third aspect.

采用本申请实施例所提供的方案,在第一设备需要向待同步设备同步文件时,第一设备获取待同步设备的子网信息及待同步的文件信息;获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息确定中是否存在第二设备的子网信息及已完成同步的文件信息;其中,第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同;同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息。若存在,则向第二设备发送同步控制指令;同步控制指令用于指示第二设备向待同步设备传输待同步文件。也就是说,同步文件的记录信息中记录有已完成文件同步的设备的子网信息及已完成同步的文件信息,在需要向待同步设备同步文件时,第一设备可以获取待同步设备的子网信息及待同步的文件信息,并获取同步文件的记录信息。然后根据待同步设备的子网信息及待同步的文件信息,在同步文件的记录信息中,检测是否存在第二设备的子网信息及已完成同步的文件信息,第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同。若存在,则说明第二设备与待同步设备处于同一子网中,并且第二设备中存储有待同步设备需要同步的文件,因此,第一设备可以向第二设备发送同步控制指令,以使得第二设备向待同步设备传输待同步文件。这样一来,在第一设备需要向待同步设备同步文件时,若第一设备所属子网与待同步设备所属子网不同,而第二设备与待同步设备所属子网相同,并且第二设备已经同步过待同步设备需要同步的文件,那么第一设备可以调度第二设备向待同步设备发送待同步文件。由于第二设备所属子网与待同步设备所属子网相同,因此相对于第一设备直接对待同步设备进行跨子网传输待同步文件,由第二设备向待同步设备传输待同步文件的速度更快,效率更高。Using the solution provided by the embodiment of this application, when the first device needs to synchronize a file to the device to be synchronized, the first device obtains the subnet information of the device to be synchronized and the file information to be synchronized; obtains the record information of the synchronized file, and based on Whether the subnet information of the device to be synchronized and the file information to be synchronized include the subnet information of the second device and the file information that has been synchronized when determining the record information of the synchronized file; among them, the subnet information of the second device and the file information that has been synchronized have been completed. The synchronized file information is the same as the subnet information of the device to be synchronized and the file information to be synchronized; the record information of the synchronized file is used to record the subnet information of the device that has completed file synchronization and the file information that has completed the synchronization. If it exists, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. That is to say, the record information of the synchronization file records the subnet information of the device that has completed the file synchronization and the file information that has completed the synchronization. When it is necessary to synchronize the file to the device to be synchronized, the first device can obtain the subnet of the device to be synchronized. Network information and file information to be synchronized, and obtain record information of synchronized files. Then, according to the subnet information of the device to be synchronized and the file information to be synchronized, in the record information of the synchronized file, it is detected whether there is the subnet information of the second device and the file information that has completed synchronization. The subnet information of the second device and The file information that has been synchronized is the same as the subnet information of the device to be synchronized and the file information to be synchronized. If it exists, it means that the second device and the device to be synchronized are in the same subnet, and the second device stores files that need to be synchronized by the device to be synchronized. Therefore, the first device can send a synchronization control instruction to the second device, so that the second device The second device transmits the file to be synchronized to the device to be synchronized. In this way, when the first device needs to synchronize files to the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device and the device to be synchronized belong are the same, and the second device The files that need to be synchronized by the device to be synchronized have been synchronized, and the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, compared to the first device directly transmitting the file to be synchronized across subnets to the device to be synchronized, the speed of the second device to transmit the file to be synchronized to the device to be synchronized is faster. Faster and more efficient.

附图说明Description of the drawings

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting any creative effort.

图1为本申请实施例提供的一种文件同步的场景示意图;Figure 1 is a schematic diagram of a file synchronization scenario provided by an embodiment of the present application;

图2为本申请实施例提供的另一种文件同步方法的流程示意图;Figure 2 is a schematic flow chart of another file synchronization method provided by an embodiment of the present application;

图3为本申请实施例提供的另一种文件同步方法的流程示意图;Figure 3 is a schematic flow chart of another file synchronization method provided by an embodiment of the present application;

图4为本申请实施例提供的另一种文件同步方法的流程示意图;Figure 4 is a schematic flow chart of another file synchronization method provided by an embodiment of the present application;

图5为本申请实施例提供的另一种文件同步方法的流程示意图;Figure 5 is a schematic flow chart of another file synchronization method provided by an embodiment of the present application;

图6为本申请实施例提供的另一种文件同步的场景示意图;Figure 6 is a schematic diagram of another file synchronization scenario provided by an embodiment of the present application;

图7为本申请实施例提供的另一种文件同步方法的流程示意图;Figure 7 is a schematic flow chart of another file synchronization method provided by an embodiment of the present application;

图8为本申请实施例提供的一种文件同步装置的结构示意图;Figure 8 is a schematic structural diagram of a file synchronization device provided by an embodiment of the present application;

图9为本申请实施例提供的另一种文件同步装置的结构示意图;Figure 9 is a schematic structural diagram of another file synchronization device provided by an embodiment of the present application;

图10为本申请实施例提供的另一种文件同步装置的结构示意图;Figure 10 is a schematic structural diagram of another file synchronization device provided by an embodiment of the present application;

图11为本申请实施例提供的另一种文件同步装置的结构示意图;Figure 11 is a schematic structural diagram of another file synchronization device provided by an embodiment of the present application;

图12为本申请实施例提供的一种电子设备的结构示意图。Figure 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solution of the present application, the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of this application.

在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terminology used in the embodiments of the present application is only for the purpose of describing specific embodiments and is not intended to limit the present application. As used in the embodiments and the appended claims, the singular forms "a," "the" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise.

应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,甲和/或乙,可以表示:单独存在甲,同时存在甲和乙,单独存在乙这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" used in this article is only an association relationship describing related objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, and A and A exist simultaneously. B, there are three situations of B alone. In addition, the character "/" in this article generally indicates that the related objects are an "or" relationship.

在对本申请实施例进行具体介绍之前,首先对本申请实施例应用或可能应用的术语进行解释。Before giving a detailed introduction to the embodiments of the present application, terminology that is or may be applied in the embodiments of the present application is first explained.

点对点技术(Peer-to-Peer,P2P):又称对等互联网络技术,是一种网络新技术,依赖网络中参与者的计算能力和带宽,而不是把依赖都聚集在较少的几台服务器上。P2P网络是没有中心服务器、依靠用户群节点进行信息交换的对等式网络。区别于传统的中央服务器结构,P2P网络中每一个用户节点既是客户端又是服务端,能同时作为服务器给其他节点提供服务。处于P2P网络中的任意两台设备间都可以共享数据。Peer-to-Peer (P2P): Also known as peer-to-peer Internet technology, it is a new network technology that relies on the computing power and bandwidth of participants in the network, rather than relying on a few computers. on the server. P2P network is a peer-to-peer network that does not have a central server and relies on user group nodes for information exchange. Different from the traditional central server structure, each user node in the P2P network is both a client and a server, and can serve as a server to provide services to other nodes at the same time. Data can be shared between any two devices in a P2P network.

网络地址转换(Network Address Translation,NAT):当在专用网内部的一些主机本来已经分配到了本地IP(Internet Protocol,网际互联协议)地址(即仅在本专用网内使用的专用地址),但又想和因特网上的主机通信(并不需要加密)时,可使用NAT方法。这种方法需要在专用网(私网IP)连接到因特网(公网IP)的路由器上安装NAT软件。装有NAT软件的路由器叫做NAT路由器,它至少有一个有效的外部全球IP地址(公网IP地址)。这样,所有使用本地地址(私网IP地址)的主机在和外界通信时,都要在NAT路由器上将其本地地址转换成全球IP地址,才能和因特网连接。Network Address Translation (NAT): When some hosts within the private network have been assigned local IP (Internet Protocol, Internet Protocol) addresses (that is, private addresses used only within this private network), but they are When you want to communicate with a host on the Internet (without encryption), you can use the NAT method. This method requires installing NAT software on the router connecting the private network (private network IP) to the Internet (public network IP). A router equipped with NAT software is called a NAT router, and it has at least one valid external global IP address (public IP address). In this way, when all hosts using local addresses (private IP addresses) communicate with the outside world, their local addresses must be converted into global IP addresses on the NAT router before they can connect to the Internet.

NAT穿越:NAT穿越涉及TCP/IP网络中的一个常见问题,即在处于使用了NAT设备的私有TCP/IP网络中的主机之间建立连接的问题。NAT traversal: NAT traversal involves a common problem in TCP/IP networks, that is, the problem of establishing connections between hosts in a private TCP/IP network using NAT devices.

路由器(Router):是连接两个或多个网络的硬件设备,在网络间起网关的作用,是读取每一个数据包中的地址然后决定如何传送的网络设备。它能够理解不同的协议,例如某个局域网使用的以太网协议,因特网使用的TCP(Transmission Control Protocol,传输控制协议)/IP协议。这样,路由器可以分析各种不同类型网络传来的数据包的目的地址,把非TCP/IP网络的地址转换成TCP/IP地址,或者反之;再根据选定的路由算法把各数据包按最佳路线传送到指定位置。所以路由器可以把非TCP/IP网络连接到因特网上。Router: It is a hardware device that connects two or more networks. It acts as a gateway between networks. It is a network device that reads the address in each data packet and then decides how to transmit it. It can understand different protocols, such as the Ethernet protocol used by a certain local area network, and the TCP (Transmission Control Protocol)/IP protocol used by the Internet. In this way, the router can analyze the destination addresses of data packets from various types of networks, convert the addresses of non-TCP/IP networks into TCP/IP addresses, or vice versa; and then route each data packet according to the selected routing algorithm. Deliver the best route to the specified location. So the router can connect non-TCP/IP networks to the Internet.

交换机(Switch):交换机意为“开关”是一种用于电(光)信号转发的网络设备。它可以为接入交换机的任意两个网络节点提供独享的电信号通路。最常见的交换机是以太网交换机。Switch: Switch means "switch" and is a network device used for forwarding electrical (optical) signals. It can provide an exclusive electrical signal path for any two network nodes connected to the switch. The most common switch is an Ethernet switch.

相关技术中,在煤矿工业领域,通过集控中心设备对多种煤矿开采所需的设备进行管理。以液压支架设备为例,液压支架设备是以液压为动力实现升降、前移等运动,进行顶板支护的设备,是煤矿综合机械化开采的关键设备,对现代煤矿生产意义重大。在液压支架设备的使用过程中,集控中心设备可以向多台液压支架设备同步文件,例如,当开发出液压支架设备的软件升级包或者需要对液压支架设备进行模型配置时,集控中心设备需要向多台液压支架设备发送软件升级包或者模型配置文件,以实现对多台液压支架设备的升级和配置,当然,集控中心设备还可以向液压支架设备同步其他文件。对于多台相同型号的液压支架设备来说,需同步的文件均相同。Among related technologies, in the field of coal mining industry, various equipment required for coal mining are managed through centralized control center equipment. Take hydraulic support equipment as an example. Hydraulic support equipment is a device that uses hydraulic pressure to achieve lifting, forward movement, etc., and perform roof support. It is a key equipment for comprehensive mechanized mining of coal mines and is of great significance to modern coal mine production. During the use of hydraulic support equipment, the centralized control center equipment can synchronize files to multiple hydraulic support equipment. For example, when a software upgrade package for the hydraulic support equipment is developed or model configuration of the hydraulic support equipment needs to be performed, the centralized control center equipment It is necessary to send software upgrade packages or model configuration files to multiple hydraulic support equipment to realize the upgrade and configuration of multiple hydraulic support equipment. Of course, the centralized control center equipment can also synchronize other files to the hydraulic support equipment. For multiple hydraulic support equipment of the same model, the files that need to be synchronized are the same.

现有技术中,煤矿工业组网中包含多个子网,如图1所示,通常情况下集控中心设备与多台液压支架设备处于不同的子网中,例如,集控中心设备处于子网1中、多台液压支架设备处于子网2中。因此,集控中心设备在向液压支架设备同步文件时,需要分别向多台液压支架设备进行跨子网传输需同步的文件。而在跨子网传输需同步的文件过程中,传输的数据包(需同步的文件)需要经过多个路由节点,每经过一个路由节点,该路由节点都需要对传输的数据包进行处理,例如寻址、数据封装和数据解封装等,如图1所示,集控中心设备向液压支架设备1同步文件时,数据包会从集控中心设备到达子网1中的交换机,然后到达路由器,再由路由器将数据包转发至子网2的交换机,并由子网2的交换机将数据包传输至液压支架设备1,因此跨子网进行文件同步需要耗费的时间较长、效率较低。并且,当集控中心设备需要向液压支架设备1、液压支架设备2…液压支架设备n同步同一份文件时,集控中心设备需要向每台液压支架设备分别发送需同步的文件,导致集控中心设备的负载较大,进一步增加了文件同步的耗时,降低文件同步的效率。In the existing technology, the coal mine industrial network contains multiple subnets, as shown in Figure 1. Usually, the centralized control center equipment and multiple hydraulic support equipment are in different subnets. For example, the centralized control center equipment is in a subnet. In 1, multiple hydraulic support equipment are located in subnet 2. Therefore, when the centralized control center equipment synchronizes files to the hydraulic support equipment, it needs to transmit the files that need to be synchronized across subnets to multiple hydraulic support equipment. In the process of transferring files that need to be synchronized across subnets, the transferred data packets (files that need to be synchronized) need to pass through multiple routing nodes. Each time they pass through a routing node, the routing node needs to process the transmitted data packets, for example addressing, data encapsulation and data decapsulation, etc., as shown in Figure 1, when the centralized control center device synchronizes files to the hydraulic support device 1, the data packet will arrive from the centralized control center device to the switch in subnet 1, and then to the router. The router then forwards the data packet to the switch in subnet 2, and the switch in subnet 2 transmits the data packet to hydraulic support device 1. Therefore, file synchronization across subnets takes a long time and is inefficient. Moreover, when the centralized control center equipment needs to synchronize the same file to hydraulic support equipment 1, hydraulic support equipment 2...hydraulic support equipment n, the centralized control center equipment needs to send the files that need to be synchronized to each hydraulic support equipment separately, resulting in centralized control The load on the central device is relatively large, which further increases the time required for file synchronization and reduces the efficiency of file synchronization.

在一些技术中,通过点对点技术(Peer-to-Peer,P2P)实现文件同步,利用P2P技术可以使计算机之间不通过服务器直接进行内容共享和数据分发,使得互联网上任意两台机器间共享数据成为可能。在煤矿工业场景下,假设集控中心设备及进行煤矿开采所需的设备均为P2P网络中的设备,P2P通常用于跨子网的两个设备通信,由于跨子网设备之间通常存在NAT隔离,因此需要经过NAT探测获得NAT的类型,然后根据NAT探测的结果实现NAT穿越,才能建立设备间的连接通路,以进行文件传输。但是NAT穿越的过程复杂、耗时较长,导致设备间建立连接通路的效率较低,从而使得文件传输的效率较低。并且NAT探测可能存在失败的情况,导致无法实现NAT穿越,进而导致设备间的连接通路无法建立,从而无法进行文件传输。并且,在P2P网络中,如果需要进行文件传输的两个设备在同一子网内,那么采用P2P技术无法实现处于同一子网的两个设备的二层传输,仍然需要NAT网关介入,导致传输效率降低。因此,对于采用P2P技术实现文件同步的方法,设备间的NAT穿越会影响文件同步的效率,甚至在NAT探测失败时导致文件传输失败,并且,对于同一子网中的两个设备,也需要进行NAT穿越,无法直接进行通信,从而影响同一子网中设备间的文件传输的效率。In some technologies, file synchronization is achieved through peer-to-peer technology (Peer-to-Peer, P2P). P2P technology can be used to directly share content and distribute data between computers without going through a server, allowing data to be shared between any two machines on the Internet. become possible. In the coal mining industry scenario, it is assumed that the centralized control center equipment and the equipment required for coal mining are all equipment in the P2P network. P2P is usually used for communication between two devices across subnets. Since there is usually NAT between cross-subnet devices, Isolation, so it is necessary to obtain the NAT type through NAT detection, and then implement NAT traversal based on the results of the NAT detection to establish a connection path between devices for file transfer. However, the process of NAT traversal is complex and time-consuming, resulting in low efficiency in establishing connection paths between devices, thus making file transfer efficiency low. In addition, NAT detection may fail, resulting in NAT traversal being unable to be achieved, which in turn causes the connection path between devices to be unable to be established, and thus file transfer cannot be performed. Moreover, in a P2P network, if the two devices that need to transfer files are in the same subnet, then using P2P technology cannot achieve Layer 2 transmission between the two devices in the same subnet. NAT gateway is still required to intervene, resulting in transmission efficiency reduce. Therefore, for the method of using P2P technology to achieve file synchronization, NAT traversal between devices will affect the efficiency of file synchronization, and even cause file transfer failure when NAT detection fails. Moreover, for two devices in the same subnet, it is also necessary to NAT traversal cannot communicate directly, thus affecting the efficiency of file transfer between devices in the same subnet.

针对上述问题,本申请实施例提供了一种文件同步方法,应用于第一设备,所述方法包括:获取待同步设备的子网信息及待同步的文件信息;获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息确定是否存在第二设备的子网信息及已完成同步的文件信息;其中,第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同;所述同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息。若存在,则向第二设备发送同步控制指令;同步控制指令用于指示第二设备向待同步设备传输待同步文件。也就是说,同步文件的记录信息中记录有已完成文件同步的设备的子网信息及已完成同步的文件信息,在需要向待同步设备同步文件时,第一设备可以获取待同步设备的子网信息及待同步的文件信息,并获取同步文件的记录信息。然后根据待同步设备的子网信息及待同步的文件信息,在同步文件的记录信息中,检测是否存在第二设备的子网信息及已完成同步的文件信息,所述第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同。若存在,则说明第二设备与第一设备处于同一子网中,并且第二设备中存储有待同步设备需要同步的文件,因此,第一设备可以向第二设备发送同步控制指令,以使得第二设备向待同步设备传输待同步文件。In response to the above problems, embodiments of the present application provide a file synchronization method, which is applied to the first device. The method includes: obtaining the subnet information of the device to be synchronized and the file information to be synchronized; obtaining the record information of the synchronized file, and Determine whether there is subnet information of the second device and completed synchronized file information based on the subnet information of the device to be synchronized and the file information to be synchronized in the synchronized file; wherein, the subnet information of the second device and the completed synchronized file information are The synchronized file information is the same as the subnet information of the device to be synchronized and the file information to be synchronized; the record information of the synchronized file is used to record the subnet information of the device that has completed file synchronization and the file information that has completed the synchronization. If it exists, a synchronization control instruction is sent to the second device; the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. That is to say, the record information of the synchronization file records the subnet information of the device that has completed the file synchronization and the file information that has completed the synchronization. When it is necessary to synchronize the file to the device to be synchronized, the first device can obtain the subnet of the device to be synchronized. Network information and file information to be synchronized, and obtain record information of synchronized files. Then, according to the subnet information of the device to be synchronized and the file information to be synchronized, in the record information of the synchronized file, it is detected whether there is the subnet information of the second device and the file information that has completed synchronization. The subnet of the second device The information and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized. If it exists, it means that the second device and the first device are in the same subnet, and the second device stores files that need to be synchronized by the device to be synchronized. Therefore, the first device can send a synchronization control instruction to the second device, so that the second device can The second device transmits the file to be synchronized to the device to be synchronized.

这样一来,在第一设备需要向待同步设备同步文件时,若第一设备所属子网与待同步设备所属子网不同,而第二设备与待同步设备所属子网相同,并且第二设备已经同步过待同步设备需要同步的文件,那么第一设备可以调度第二设备向待同步设备发送待同步文件。由于第二设备所属子网与待同步设备所属子网相同,因此相对于第一设备直接对待同步设备进行跨子网传输待同步文件,由第二设备向待同步设备传输待同步文件的速度更快,效率更高。以下进行详细说明。In this way, when the first device needs to synchronize files to the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device and the device to be synchronized belong are the same, and the second device The files that need to be synchronized by the device to be synchronized have been synchronized, and the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, compared to the first device directly transmitting the file to be synchronized across subnets to the device to be synchronized, the speed at which the second device transmits the file to be synchronized to the device to be synchronized is faster. Faster and more efficient. The details are explained below.

参见图2,为本申请实施例提供的一种文件同步方法的流程示意图。所述方法应用于第一设备,包括如下步骤:Refer to Figure 2, which is a schematic flow chart of a file synchronization method provided by an embodiment of the present application. The method is applied to the first device and includes the following steps:

步骤S201、获取待同步设备的子网信息及待同步的文件信息。Step S201: Obtain the subnet information of the device to be synchronized and the file information to be synchronized.

在本申请实施例中,第一设备对各个子网中的设备进行管理,例如,第一设备管理各个子网中每个设备内配置的文件,以及负责对每个设备内配置的文件的升级更新等。当技术人员开发出软件升级包、设备的模型配置文件等更新文件时,需要将这些更新文件同步至相应的设备中,以便相应的设备对其内保存的文件进行更新。而技术人员无法直接将更新文件直接同步至相应的设备中,需要由管理各个子网的设备的第一设备进行同步。在本申请实施例中,可以将设备需要更新的文件称为待同步文件,需要进行文件更新的设备称为待同步设备。在第一设备获取到待同步设备的更新文件时,可以主动向各个配置有该更新文件的设备同步该更新文件。也可以由各个配置有该更新文件的设备请求第一设备进行更新文件的同步。即为,在第一设备获取到待同步文件时,可以主动向各个配置有该待同步文件的待同步设备发送待同步文件。也可以由各个配置有该待同步文件的设备请求第一设备进行待同步文件的同步。In this embodiment of the present application, the first device manages the devices in each subnet. For example, the first device manages the files configured in each device in each subnet, and is responsible for upgrading the files configured in each device. Updates etc. When technicians develop update files such as software upgrade packages and device model configuration files, these update files need to be synchronized to the corresponding devices so that the corresponding devices can update the files saved in them. Technical personnel cannot directly synchronize the update files to the corresponding devices. The first device that manages the devices in each subnet needs to be synchronized. In this embodiment of the present application, a file that needs to be updated by a device can be called a file to be synchronized, and a device that needs to be updated with a file can be called a device that needs to be synchronized. When the first device obtains the update file of the device to be synchronized, it can actively synchronize the update file to each device configured with the update file. Each device configured with the update file may also request the first device to synchronize the update file. That is, when the first device obtains the file to be synchronized, it can actively send the file to be synchronized to each device to be synchronized that is configured with the file to be synchronized. Each device configured with the file to be synchronized may also request the first device to synchronize the file to be synchronized.

在第一设备确定需要向待同步设备进行待同步文件的同步时,为了提高同步效率,可以通过与待同步设备位于相同子网,且已经同步完成了该待同步文件的设备为待同步设备进行同步。基于此,第一设备需要获取待同步设备的子网信息及待同步的文件信息。即为,需要先获取待同步设备位于哪个子网,及待同步设备需要同步哪个文件。When the first device determines that it needs to synchronize the file to be synchronized with the device to be synchronized, in order to improve the synchronization efficiency, a device that is located in the same subnet as the device to be synchronized and has completed synchronization of the file to be synchronized can perform the synchronization for the device to be synchronized. Synchronize. Based on this, the first device needs to obtain the subnet information of the device to be synchronized and the file information to be synchronized. That is, you need to first obtain the subnet in which the device to be synchronized is located, and which file needs to be synchronized by the device to be synchronized.

在一些实施例中,当其他设备连接至第一设备时,其他设备需要向第一设备上报其他设备内配置的文件,其他设备的标识信息,以及其他设备所属子网信息等设备相关信息,以便第一设备对其他设备的管理。此时,第一设备可以存储其他设备上报的设备相关信息。当第一设备主动向其他设备同步待同步文件时,首先第一设备可以从其他设备中获取待同步文件或者可以接收技术人员发送的待同步文件。根据该待同步文件可以确定出其文件信息,例如待同步文件的文件名称,文件大小等信息。其次,第一设备可以根据存储的设备相关信息中记录的其他设备内的配置文件,确定出待同步文件对应的待同步设备,并根据设备相关信息确定出待同步设备的子网信息。即为,第一设备获取待同步设备的子网信息及待同步文件的文件信息。In some embodiments, when other devices are connected to the first device, the other devices need to report device-related information such as files configured in the other devices, identification information of the other devices, and subnet information to which the other devices belong, to the first device, so that The first device manages other devices. At this time, the first device can store device-related information reported by other devices. When the first device actively synchronizes files to be synchronized with other devices, first the first device can obtain the files to be synchronized from other devices or can receive files to be synchronized sent by technicians. The file information of the file to be synchronized can be determined, such as the file name, file size and other information of the file to be synchronized. Secondly, the first device can determine the device to be synchronized corresponding to the file to be synchronized based on the configuration files in other devices recorded in the stored device-related information, and determine the subnet information of the device to be synchronized based on the device-related information. That is, the first device obtains the subnet information of the device to be synchronized and the file information of the file to be synchronized.

当其他设备请求第一设备同步待同步文件时,其他设备可以在请求消息中携带其子网信息及待同步文件的文件信息,第一设备可以从其他设备的请求消息中获取到待同步设备的子网信息及待同步的文件信息。When other devices request the first device to synchronize a file to be synchronized, the other device can carry its subnet information and the file information of the file to be synchronized in the request message, and the first device can obtain the file information of the device to be synchronized from the request message of the other device. Subnet information and file information to be synchronized.

当然,还可以通过其他方式获取待同步设备的子网信息及待同步的文件信息,本申请对此不作限制。例如,第一设备可以根据获取的待同步的文件信息,通过第三设备获取待同步设备的子网信息。其中,第三设备中可以存储有各个设备的子网信息,或者第三设备可以从待同步设备中获取子网信息并返回给第一设备。Of course, the subnet information of the device to be synchronized and the file information to be synchronized can also be obtained through other methods, and this application does not limit this. For example, the first device may obtain the subnet information of the device to be synchronized through the third device based on the obtained file information to be synchronized. The third device may store the subnet information of each device, or the third device may obtain the subnet information from the device to be synchronized and return it to the first device.

示例性的,以第一设备主动向待同步设备同步文件为例,假设待同步文件为液压支架设备的配置文件。在第一设备获取到液压支架设备的软件配置升级包的文件时,例如第一设备可以接收其他设备发送的液压支架设备的软件配置升级包的文件,第一设备可以确定待同步文件为液压支架设备的的配置文件。此时,第一设备可以从存储的设备相关信息中确定出待同步文件(液压支架设备的软件升级包)对应的待同步设备为液压支架设备1,还可以确定出液压支架设备1的子网信息,例如,液压支架设备1的子网信息可以是液压支架设备所属子网为子网2。这样一来,第一设备便可以获取到待同步设备的子网信息及待同步的文件信息。As an example, take the first device actively synchronizing files to the device to be synchronized, assuming that the file to be synchronized is the configuration file of the hydraulic support device. When the first device obtains the file of the software configuration upgrade package of the hydraulic support device, for example, the first device may receive the file of the software configuration upgrade package of the hydraulic support device sent by other devices, and the first device may determine that the file to be synchronized is the hydraulic support. The device's configuration file. At this time, the first device can determine from the stored device-related information that the device to be synchronized corresponding to the file to be synchronized (software upgrade package of the hydraulic support device) is the hydraulic support device 1, and can also determine the subnet of the hydraulic support device 1 Information, for example, the subnet information of the hydraulic support equipment 1 may be that the subnet to which the hydraulic support equipment belongs is subnet 2. In this way, the first device can obtain the subnet information of the device to be synchronized and the file information to be synchronized.

作为一种可能的实现方式,第一设备与待同步设备所属子网不同。As a possible implementation manner, the first device and the device to be synchronized belong to different subnets.

具体的,一个网络可以被划分为多个子网,第一设备是对各个子网中的其他设备进行集中管理的设备,在第一设备所属子网与第一设备管理的设备的所属子网不同时,第一设备需要向待同步设备进行跨子网传输待同步文件,导致文件同步效率较低。例如,第一设备所属子网为子网1,设备A所属子网为子网2、设备B所属子网为子网3,若第一设备直接向设备A或者设备B进行文件同步,需要跨子网文件传输,但是跨子网进行文件传输的过程较为复杂,传输效率较低。Specifically, a network can be divided into multiple subnets. The first device is a device that centrally manages other devices in each subnet. The subnet to which the first device belongs is different from the subnet to which the device managed by the first device belongs. At the same time, the first device needs to transmit the files to be synchronized across subnets to the device to be synchronized, resulting in low file synchronization efficiency. For example, the subnet to which the first device belongs is subnet 1, the subnet to which device A belongs is subnet 2, and the subnet to which device B belongs is subnet 3. If the first device directly synchronizes files to device A or device B, it needs to cross Subnet file transfer, but the process of file transfer across subnets is more complicated and the transfer efficiency is low.

步骤S202、获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息中确定是否存在第二设备的子网信息及已完成同步的文件信息。Step S202: Obtain the record information of the synchronization file, and determine whether there is subnet information of the second device and synchronized file information in the record information of the synchronization file based on the subnet information of the device to be synchronized and the file information to be synchronized.

其中,第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同。同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息。Among them, the subnet information of the second device and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file information to be synchronized. The record information of synchronized files is used to record the subnet information of the device that has completed file synchronization and the file information that has completed synchronization.

在本申请实施例中,第一设备在每次完成文件同步时,会将完成同步的设备的子网信息及已完成同步的文件信息记录至同步文件的记录信息中,即为同步文件的记录信息中包括已完成文件同步的设备的子网信息及已完成同步的文件信息。在第一设备需要向待同步设备同步文件时,由于第一设备与待同步设备所属子网不同,因此,如果由第一设备直接将待同步文件发送至待同步设备,需要进行跨子网文件传输,跨子网传输过程较为复杂,效率较低。在本申请实施例中,第一设备可以查找出与该待同步设备处于相同子网且已完成与待同步文件相同的文件同步的第二设备,由第二设备为待同步设备进行待同步文件的同步,实现同一个子网内文件同步,提高文件同步的效率。基于此,第一设备可以获取记录的同步文件的记录信息。其中,同步文件的记录信息中包括已完成文件同步的设备的子网信息及已完成同步的文件信息。即为,第一设备可以获取记录有已完成文件同步的设备的子网信息及该设备完成同步的文件的文件信息的同步文件的记录信息。第一设备根据待同步设备的子网信息及待同步的文件信息,在同步文件的记录信息中确定是否存在第二设备的子网信息及已完成同步的文件信息。也就是说,第一设备可以根据待同步设备的子网信息及待同步的文件信息,在同步文件的记录信息中确定是否存在子网信息与待同步设备的子网信息相同、且已完成同步的文件信息与待同步设备的待同步文件的文件信息相同的第二设备的子网信息及已完成同步的文件信息。其中,第二设备的子网信息与待同步设备的子网信息相同即为,第二设备与待同步设备处于同一子网。In this embodiment of the present application, each time the first device completes file synchronization, it will record the subnet information of the synchronized device and the synchronized file information into the record information of the synchronized file, which is the record of the synchronized file. The information includes the subnet information of the device that has completed file synchronization and the file information that has completed synchronization. When the first device needs to synchronize a file to the device to be synchronized, since the first device and the device to be synchronized belong to different subnets, therefore, if the first device directly sends the file to be synchronized to the device to be synchronized, cross-subnet file transfer is required. Transmission, the cross-subnet transmission process is more complicated and less efficient. In this embodiment of the present application, the first device can find a second device that is in the same subnet as the device to be synchronized and has completed synchronization of the same file as the file to be synchronized, and the second device performs the file synchronization for the device to be synchronized. synchronization to achieve file synchronization within the same subnet and improve the efficiency of file synchronization. Based on this, the first device can obtain the recorded information of the recorded synchronization file. Among them, the record information of the synchronized file includes the subnet information of the device that has completed the file synchronization and the file information that has completed the synchronization. That is, the first device can obtain the record information of the synchronization file that records the subnet information of the device that has completed file synchronization and the file information of the file that the device has completed synchronization. The first device determines whether the subnet information of the second device and the file information that has been synchronized exist in the record information of the synchronization file based on the subnet information of the device to be synchronized and the file information to be synchronized. That is to say, the first device can determine whether there is subnet information that is the same as the subnet information of the device to be synchronized in the record information of the synchronization file based on the subnet information of the device to be synchronized and the file information to be synchronized, and the synchronization has been completed. The file information of the second device is the same as the file information of the file to be synchronized of the device to be synchronized, and the file information of the second device that has been synchronized has been completed. Wherein, the subnet information of the second device and the subnet information of the device to be synchronized are the same, that is, the second device and the device to be synchronized are in the same subnet.

步骤S203、若存在,则向第二设备发送同步控制指令。Step S203: If it exists, send a synchronization control instruction to the second device.

其中,同步控制指令用于指示第二设备向待同步设备传输待同步文件。Wherein, the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.

在本申请实施例中,若第一设备在同步文件的记录信息中确定出存在第二设备的子网信息及已完成同步的文件信息,说明第二设备所属子网与待同步设备所属子网相同,即为第二设备与第一设备处于同一子网中,并且第二设备已经同步过待同步设备的待同步文件。此时,第一设备可以向第二设备发送同步控制指令,例如,同步控制指令中可以包括待同步设备的标识信息及待同步的文件信息,以使得第二设备在接收到同步控制指令时,根据同步控制指令向待同步设备传输待同步文件。也就是说,在第一设备需要向待同步设备同步待同步文件时,第一设备通过同步文件的记录信息若确定出第二设备所属子网与待同步设备所属子网相同,且第二设备已经同步过待同步文件,那么第一设备可以向第二设备发送同步控制指令,由于第二设备中已经存储有待同步文件,因此第二设备在接收到同步控制指令时,可以直接向待同步设备传输待同步文件。这样一来,在第一设备确定出第二设备所属子网与待同步设备所属子网相同,且第二设备已经同步过待同步文件后,向第二设备发送同步控制指令,以使得第二设备向待同步设备传输待同步文件,从而完成文件同步。由于第二设备的子网信息与待同步设备的子网信息相同,即为第二设备与待同步设备处于同一子网中,同子网的设备间可以直接进行文件传输,无需经过多次路由,传输速度较快,而第一设备与待同步设备所属子网不同,跨子网文件传输的过程比较复杂,因此由第二设备向待同步设备传输待同步文件可以提高文件同步的效率。In the embodiment of this application, if the first device determines that the subnet information of the second device and the file information that has completed synchronization exist in the record information of the synchronization file, it means that the subnet to which the second device belongs and the subnet to which the device to be synchronized belong The same means that the second device and the first device are in the same subnet, and the second device has synchronized the files to be synchronized with the device to be synchronized. At this time, the first device may send a synchronization control instruction to the second device. For example, the synchronization control instruction may include identification information of the device to be synchronized and file information to be synchronized, so that when the second device receives the synchronization control instruction, Transmit files to be synchronized to the device to be synchronized according to the synchronization control instructions. That is to say, when the first device needs to synchronize a file to be synchronized with the device to be synchronized, if the first device determines through the record information of the synchronization file that the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device The file to be synchronized has been synchronized, then the first device can send a synchronization control instruction to the second device. Since the file to be synchronized has been stored in the second device, when the second device receives the synchronization control instruction, it can directly send the synchronization control instruction to the device to be synchronized. Transfer files to be synchronized. In this way, after the first device determines that the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, and the second device has synchronized the file to be synchronized, it sends a synchronization control instruction to the second device, so that the second device The device transmits the files to be synchronized to the device to be synchronized, thereby completing file synchronization. Since the subnet information of the second device is the same as the subnet information of the device to be synchronized, that is, the second device and the device to be synchronized are in the same subnet, and files can be transferred directly between devices in the same subnet without going through multiple routes. , the transmission speed is faster, and the first device and the device to be synchronized belong to different subnets, and the process of cross-subnet file transfer is more complicated. Therefore, transferring the file to be synchronized from the second device to the device to be synchronized can improve the efficiency of file synchronization.

示例性的,假设在煤矿工业场景下,第一设备为集控中心设备,第一设备所属子网为子网1。此时,第一设备获取到液压支架设备的软件升级包,液压支架设备的软件升级包即为待同步文件,假设待同步文件的文件信息为文件B。由于第一设备存储的设备相关信息中包括每个设备的标识信息、设备的子网信息、设备中的文件的标识信息等,例如,液压支架设备C,其内配置的文件为文件B,所属子网为子网2;运输机D,其内配置的文件为文件E,所属子网为子网3。因此,第一设备根据存储的设备相关信息及待同步的文件信息,可以确定待同步的文件信息对应的待同步设备为液压支架设备C,液压支架设备C的子网信息为子网2。这样一来,第一设备可以获取到待同步设备的子网信息为子网2,待同步的文件信息为文件B。然后,第一设备可以获取同步文件的记录信息,假设同步文件的记录信息中记录有:液压支架设备F,所属子网为子网2,已完成同步的文件为文件B;运输机G,所属子网为子网3,已完成同步的文件为文件E。根据待同步设备的子网信息及待同步的文件信息,在同步文件的记录信息中确定是否存在第二设备的子网信息及已完成同步的文件信息,由于同步文件的记录信息中记录有液压支架设备F,所属子网为子网2,已完成同步的文件为文件B,那么此时,第一设备可以确定存在第二设备的子网信息及已完成同步的文件信息,第二设备即为液压支架设备F。第一设备向第二设备发送同步控制指令,以使得第二设备在接收到同步控制指令之后,向待同步设备传输待同步文件。For example, assume that in a coal mining industry scenario, the first device is a centralized control center device, and the subnet to which the first device belongs is subnet 1. At this time, the first device obtains the software upgrade package of the hydraulic support equipment. The software upgrade package of the hydraulic support equipment is the file to be synchronized. It is assumed that the file information of the file to be synchronized is file B. Since the device-related information stored by the first device includes identification information of each device, subnet information of the device, identification information of files in the device, etc., for example, hydraulic support device C, the file configured in it is file B, which belongs to The subnet is subnet 2; the file configured in transport machine D is file E, and the subnet it belongs to is subnet 3. Therefore, based on the stored device-related information and the file information to be synchronized, the first device can determine that the device to be synchronized corresponding to the file information to be synchronized is the hydraulic support device C, and the subnet information of the hydraulic support device C is subnet 2. In this way, the first device can obtain that the subnet information of the device to be synchronized is subnet 2, and the file information to be synchronized is file B. Then, the first device can obtain the record information of the synchronization file. It is assumed that the record information of the synchronization file contains: hydraulic support equipment F, the subnet to which it belongs is subnet 2, and the file that has completed synchronization is file B; the transport machine G, to which the subnet belongs The network is subnet 3, and the file that has been synchronized is file E. According to the subnet information of the device to be synchronized and the file information to be synchronized, determine whether there is the subnet information of the second device and the file information that has completed synchronization in the record information of the synchronization file. Since the record information of the synchronization file records hydraulic pressure The subnet to which bracket device F belongs is subnet 2, and the file that has been synchronized is file B. At this time, the first device can determine that the subnet information of the second device and the file information that has been synchronized exist. The second device is It is hydraulic support equipment F. The first device sends a synchronization control instruction to the second device, so that after receiving the synchronization control instruction, the second device transmits the file to be synchronized to the device to be synchronized.

作为一种可能的实现方式,上述若存在,则向第二设备发送同步控制指令包括:As a possible implementation manner, if the above exists, sending a synchronization control instruction to the second device includes:

若存在,且存在至少两个第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同,则获取至少两个第二设备的负载信息;If there is, and the subnet information and synchronized file information of at least two second devices are the same as the subnet information and file information of the device to be synchronized, obtain the load information of at least two second devices;

根据至少两个第二设备的负载信息,确定目标第二设备,向目标第二设备发送同步控制指令。Determine a target second device based on the load information of at least two second devices, and send a synchronization control instruction to the target second device.

在本申请实施例中,由于同步文件的记录信息中记录了第一设备已经完成文件的设备的子网信息及已完成同步的文件信息。因此,在第一设备根据待同步设备的子网信息及待同步的文件信息在同步问价的记录信息中查找是否有与待同步设备的子网信息及待同步的文件信息相同的第二设备的子网信息及已完成同步的文件信息时,可能有至少两个第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同。此时,在存在第二设备的子网信息及已完成同步的文件信息,且存在至少两个时,即为存在至少两个第二设备的子网信息与待同步设备的子网信息相同,且至少两个第二设备已完成的同步文件信息与待同步设备的待同步文件的文件信息相同时,则第一设备可以获取至少两个第二设备的负载信息。此时,第一设备可以分别向至少两个第二设备发送获取其负载信息的请求消息,由至少两个第二设备告知第一设备至少两个第二设备各自的负载信息。第一设备也可以在每次控制其他设备向待同步设备进行文件同步时,记录为每个其他设备分配的同步任务的个数,通过获取为每个第二设备分配的同步任务的个数来获取至少两个第二设备的负载信息。第一设备在获取了每个第二设备的负载信息后,可以根据每个第二设备的负载信息,通过负载均衡原则确定该待同步设备对应的目标第二设备。即为,第一设备在获取了每个第二设备的负载信息后,可以将负载信息中记录的负载个数较少的第二设备确定为待同步设备对应的目标第二设备,实现每个第二设备负载均衡,提高同步效率。第一设备在确定出目标第二设备后,可以向目标第二设备发送同步控制指令,以控制目标第二设备为待同步设备进行待同步文件的同步。In the embodiment of the present application, the record information of the synchronization file records the subnet information of the device on which the first device has completed the file and the file information of the completed synchronization. Therefore, the first device searches the record information of the synchronization inquiry based on the subnet information of the device to be synchronized and the file information to be synchronized to see whether there is a second device that is the same as the subnet information of the device to be synchronized and the file information to be synchronized. When the subnet information and synchronized file information are obtained, there may be at least two second devices whose subnet information and synchronized file information are the same as those of the device to be synchronized and the file information to be synchronized. At this time, when there are subnet information of the second device and file information that has been synchronized, and there are at least two of them, it means that there are at least two second devices whose subnet information is the same as the subnet information of the device to be synchronized. And when the synchronized file information of at least two second devices is the same as the file information of the files to be synchronized of the device to be synchronized, the first device can obtain the load information of the at least two second devices. At this time, the first device may respectively send request messages to obtain the load information of the at least two second devices, and the at least two second devices inform the first device of the respective load information of the at least two second devices. The first device can also record the number of synchronization tasks assigned to each other device each time it controls other devices to synchronize files with the device to be synchronized, and obtain the number of synchronization tasks assigned to each second device. Obtain load information of at least two second devices. After obtaining the load information of each second device, the first device can determine the target second device corresponding to the device to be synchronized according to the load balancing principle based on the load information of each second device. That is, after obtaining the load information of each second device, the first device can determine the second device with a smaller number of loads recorded in the load information as the target second device corresponding to the device to be synchronized, realizing each The second device is load balanced to improve synchronization efficiency. After determining the target second device, the first device may send a synchronization control instruction to the target second device to control the target second device to synchronize files to be synchronized for the device to be synchronized.

应理解,第二设备的负载信息可以是第二设备需为其他设备进行文件同步的同步任务的个数的信息。It should be understood that the load information of the second device may be information on the number of synchronization tasks that the second device needs to perform file synchronization for other devices.

作为一种可能的实现方式中,待同步设备包括至少两个。此时,上述根据至少两个第二设备的负载信息,确定目标第二设备包括:As a possible implementation, the devices to be synchronized include at least two. At this time, determining the target second device based on the load information of at least two second devices includes:

针对至少两个待同步设备中的每个待同步设备,根据至少两个第二设备的负载信息,确定每个待同步设备对应的目标第二设备。For each device to be synchronized among the at least two devices to be synchronized, a target second device corresponding to each device to be synchronized is determined based on the load information of the at least two second devices.

在本申请实施例中,当第一设备需要为至少两个待同步设备进行待同步文件的同步,且确定出至少两个第二设备可以为至少两个待同步设备进行待同步文件的同步时,第一设备可以针对每个待同步文件确定出其对应的目标第二设备。即为,针对至少两个待同步设备中的每个待同步设备,第一设备根据至少两个第二设备的负载信息,确定每个待同步设备对应的目标第二设备,这样一来,可以将至少两个第二设备负载均衡的为至少两个同步设备进行待同步文件的同步。In this embodiment of the present application, when the first device needs to synchronize files to be synchronized for at least two devices to be synchronized, and it is determined that at least two second devices can synchronize files to be synchronized for at least two devices to be synchronized. , the first device can determine its corresponding target second device for each file to be synchronized. That is, for each of the at least two devices to be synchronized, the first device determines the target second device corresponding to each device to be synchronized based on the load information of the at least two second devices. In this way, it is possible The at least two second devices are load-balanced to synchronize files to be synchronized for at least two synchronization devices.

这样一来,在第一设备需要向待同步设备同步文件时,若第一设备所属子网与待同步设备所属子网不同,而第二设备与待同步设备所属子网相同,并且第二设备已经同步过待同步设备需要同步的文件,那么第一设备可以调度第二设备向待同步设备发送待同步文件。由于第二设备与待同步设备所属子网相同,因此相对于第一设备直接对待同步设备进行跨子网传输待同步文件,由第二设备向待同步设备传输待同步文件的速度更快,效率更高。In this way, when the first device needs to synchronize files to the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the subnet to which the second device and the device to be synchronized belong are the same, and the second device The files that need to be synchronized by the device to be synchronized have been synchronized, and the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the second device and the device to be synchronized belong to the same subnet, compared with the first device directly transmitting the file to be synchronized across subnets to the device to be synchronized, the transmission of the file to be synchronized from the second device to the device to be synchronized is faster and more efficient. higher.

作为一种可能的实现方式,当第一设备与待同步设备的子网信息相同时,也可以通过上述方法实现第一设备与待同步设备间的文件同步。虽然在第一设备与待同步设备的子网信息相同时,由第一设备直接向待同步设备发送待同步文件不会存在跨子网文件传输导致的文件同步效率低的问题,但是,当存在多个待同步设备时,第一设备向多个待同步设备发送待同步文件会导致第一设备的运行负载急剧增大,导致文件同步较慢,也会在一定程度上降低文件同步效率,此时采用上述文件同步方法,可以减轻第一设备的运行负载,从而提高文件同步的效率。As a possible implementation manner, when the subnet information of the first device and the device to be synchronized is the same, file synchronization between the first device and the device to be synchronized can also be implemented through the above method. Although when the subnet information of the first device and the device to be synchronized is the same, the first device directly sends the file to be synchronized to the device to be synchronized without causing the problem of low file synchronization efficiency caused by cross-subnet file transfer. However, when there is When there are multiple devices to be synchronized, sending the files to be synchronized by the first device to multiple devices to be synchronized will cause the operating load of the first device to increase sharply, resulting in slower file synchronization, and also reducing the file synchronization efficiency to a certain extent. When using the above file synchronization method, the operating load of the first device can be reduced, thereby improving the efficiency of file synchronization.

图3为本申请实施例提供的另一种文件同步方法的流程示意图。所述方法应用于第二设备,具体包括如下步骤:Figure 3 is a schematic flowchart of another file synchronization method provided by an embodiment of the present application. The method is applied to the second device and specifically includes the following steps:

步骤S301、接收同步控制指令。Step S301: Receive synchronization control instructions.

其中,同步控制指令用于指示第二设备向待同步设备传输待同步文件。Wherein, the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.

具体的,在第一设备确定第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同时,第一设备会向第二设备发送同步控制指令,同步控制指令中可以包括待同步设备的标识信息及待同步的文件信息,第二设备接收同步控制指令,获知需要向待同步设备传输待同步文件。Specifically, when the first device determines that the subnet information and synchronized file information of the second device are the same as the subnet information and file information of the device to be synchronized, the first device will send a synchronization control to the second device. The synchronization control instruction may include the identification information of the device to be synchronized and the file information to be synchronized. The second device receives the synchronization control instruction and learns that it needs to transmit the file to be synchronized to the device to be synchronized.

步骤S302、根据同步控制指令,确定待同步的文件信息及待同步设备。Step S302: Determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.

在本申请实施例中,同步控制指令用于指示第二设备向待同步设备传输待同步文件,第二设备通过解析同步控制指令,可以获知待同步的文件信息及待同步设备。In this embodiment of the present application, the synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized. By parsing the synchronization control instruction, the second device can obtain the file information to be synchronized and the device to be synchronized.

步骤S303、根据待同步的文件信息获取待同步文件,并向待同步设备发送待同步文件。Step S303: Obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.

在本申请实施例中,第二设备解析同步控制指令,得到待同步的文件信息后,可以根据待同步的文件信息,查找自身的文件,确定出文件信息与待同步的文件信息相同的文件,将其作为待同步文件,第二设备在获取了待同步文件后,可以向确定出的待同步设备发送待同步文件。In this embodiment of the present application, after the second device parses the synchronization control instructions and obtains the file information to be synchronized, it can search for its own files based on the file information to be synchronized, and determine the files whose file information is the same as the file information to be synchronized. Treat it as a file to be synchronized. After obtaining the file to be synchronized, the second device can send the file to be synchronized to the determined device to be synchronized.

应理解的,第二设备是已完成待同步文件的文件信息标识出的文件的设备,且第二设备的子网信息与待同步设备的子网信息相同,因此第二设备与待同步设备处于相同的子网内。因此,第二设备向待同步设备传输待同步文件时,是在同一子网内进行文件同步,文件同步效率较高。It should be understood that the second device is a device that has completed the file identified by the file information of the file to be synchronized, and the subnet information of the second device is the same as the subnet information of the device to be synchronized, so the second device and the device to be synchronized are in within the same subnet. Therefore, when the second device transmits the files to be synchronized to the device to be synchronized, the files are synchronized within the same subnet, and the file synchronization efficiency is high.

图4为本申请实施例提供的另一种文件同步方法的流程示意图。所述方法应用于待同步设备,具体包括如下步骤:Figure 4 is a schematic flowchart of another file synchronization method provided by an embodiment of the present application. The method is applied to the device to be synchronized, and specifically includes the following steps:

步骤S401、接收待同步文件。Step S401: Receive files to be synchronized.

具体的,待同步设备需要同步文件时,可能会由第一设备直接向待同步设备发送待同步文件,也可能是与待同步设备所属子网相同,并且已同步过待同步文件的第二设备向待同步设备发送待同步文件,此时,待同步设备可以接收由第一设备或第二设备发送的待同步文件。Specifically, when the device to be synchronized needs to synchronize a file, the first device may directly send the file to be synchronized to the device to be synchronized, or it may be a second device that belongs to the same subnet as the device to be synchronized and has already synchronized the file to be synchronized. Send the file to be synchronized to the device to be synchronized. At this time, the device to be synchronized may receive the file to be synchronized sent by the first device or the second device.

步骤S402、根据待同步文件,更新相应的文件。Step S402: Update the corresponding file according to the file to be synchronized.

具体的,待同步设备在接收到待同步文件之后,可以根据待同步文件,更新待同步设备中相应的文件,以完成文件同步。Specifically, after receiving the file to be synchronized, the device to be synchronized can update the corresponding file in the device to be synchronized according to the file to be synchronized to complete the file synchronization.

在本申请实施例中,存在第一设备主动向待同步设备发送待同步文件,和待同步设备主动向第一设备请求进行文件同步两种方式,为更清楚的说明第一设备、第二设备及待同步设备间的信息交互,在本实施例中以第一设备主动向待同步设备发送待同步文件为例进行说明,图5为本申请实施例提供的另一种文件同步方法的流程示意图。具体包括如下步骤:In the embodiment of this application, there are two ways: the first device actively sends files to be synchronized to the device to be synchronized, and the device to be synchronized actively requests the first device for file synchronization. To explain more clearly, the first device and the second device and information interaction between devices to be synchronized. In this embodiment, the first device actively sends a file to be synchronized to the device to be synchronized as an example. Figure 5 is a schematic flow chart of another file synchronization method provided by an embodiment of the present application. . Specifically, it includes the following steps:

步骤S501、第一设备获取待同步设备的子网信息及待同步的文件信息。Step S501: The first device obtains the subnet information of the device to be synchronized and the file information to be synchronized.

具体可参考步骤S201,在此不再赘述。For details, reference may be made to step S201, which will not be described again here.

作为一种可能的实现方式,由于可能存在至少两个待同步设备进行文件同步的情况。待同步设备需要确定出至少两个待同步设备的子网信息及待同步文件的文件信息。在至少两个待同步设备的类型相同时,其待同步文件相同。As a possible implementation method, there may be a situation where at least two devices to be synchronized perform file synchronization. The device to be synchronized needs to determine the subnet information of at least two devices to be synchronized and the file information of the file to be synchronized. When at least two devices to be synchronized are of the same type, their files to be synchronized are the same.

以煤矿工业场景中的液压支架设备为例,多个液压支架设备需要进行文件1的升级,在多个液压支架设备的类型相同时,则多个液压支架设备需要升级的文件1相同,即为需要更新的文件1相同。因此,假设第一设备获取到液压支架设备的文件1的软件升级包文件,第一设备可以确定需要向多个液压支架设备进行文件1的升级。此时,第一设备可以将需要升级文件1的液压支架设备确定为待同步设备,将文件1的软件升级包文件确定为待同步文件。第一设备此时可以确定出多个待同步设备。通过检测记录的设备相关信息,可以分别确定出待同步设备的子网信息。假设,多个液压支架设备的子网信息相同,均为属于子网1。此时,第一设备可以确定出多个待同步设备的子网信息为属于子网1,假设待同步文件的文件信为待同步文件的文件名称。此时,第一设备可以确定出多个待同步设备的待同步文件的文件信息为文件1。Taking the hydraulic support equipment in the coal mine industry scenario as an example, multiple hydraulic support equipment need to upgrade file 1. When the types of multiple hydraulic support equipment are the same, the file 1 that needs to be upgraded for multiple hydraulic support equipment is the same, which is File 1 that needs to be updated is the same. Therefore, assuming that the first device obtains the software upgrade package file of file 1 of the hydraulic support device, the first device can determine that file 1 needs to be upgraded to multiple hydraulic support devices. At this time, the first device may determine the hydraulic support device that needs to upgrade file 1 as the device to be synchronized, and determine the software upgrade package file of file 1 as the file to be synchronized. At this time, the first device can determine multiple devices to be synchronized. By detecting the recorded device-related information, you can determine the subnet information of the device to be synchronized. Assume that the subnet information of multiple hydraulic support equipment is the same and they all belong to subnet 1. At this time, the first device can determine that the subnet information of the multiple devices to be synchronized belongs to subnet 1, assuming that the file information of the file to be synchronized is the file name of the file to be synchronized. At this time, the first device may determine that the file information of the files to be synchronized in the multiple devices to be synchronized is file 1.

步骤S502、第一设备向待同步设备发送同步文件通知消息,待同步设备接收同步文件通知消息。Step S502: The first device sends a synchronization file notification message to the device to be synchronized, and the device to be synchronized receives the synchronization file notification message.

具体的,在进行文件同步之前,第一设备需向告知待同步设备进行文件1的文件同步。此时,第一设备向待同步设备发送同步文件通知消息,以告知待同步设备需要对其进行文件同步。一种可能的实现方式中,同步文件通知消息中携带有待同步文件的文件信息,以便告知待同步设备需要同步哪些文件。待同步设备接收第一设备发送的同步文件通知消息,从而获知第一设备需要对其进行文件同步,并通过同步文件通知消息中携带的待同步文件的文件信息,可以获知第一设备需要对哪些文件进行同步。Specifically, before performing file synchronization, the first device needs to notify the device to be synchronized to perform file synchronization of file 1. At this time, the first device sends a synchronization file notification message to the device to be synchronized to inform the device to be synchronized that it needs to perform file synchronization. In one possible implementation, the synchronization file notification message carries file information of the files to be synchronized, so as to inform the device to be synchronized which files need to be synchronized. The device to be synchronized receives the synchronization file notification message sent by the first device, thereby learning that the first device needs to perform file synchronization on it, and can learn which files the first device needs to synchronize through the file information of the file to be synchronized carried in the synchronization file notification message. files are synchronized.

作为一种可能的实现方式,若存在至少两个待同步设备,那么第一设备需要向至少两个待同步设备分别发送同步文件通知消息。As a possible implementation manner, if there are at least two devices to be synchronized, the first device needs to send synchronization file notification messages to the at least two devices to be synchronized respectively.

步骤S503、待同步设备向第一设备发送同步文件响应消息,第一设备接收待同步设备发送的同步文件响应消息。Step S503: The device to be synchronized sends a synchronization file response message to the first device, and the first device receives the synchronization file response message sent by the device to be synchronized.

其中,同步文件响应消息中携带有待同步设备的文件传输端口信息。The synchronization file response message carries the file transfer port information of the device to be synchronized.

在本申请实施例中,待同步设备在接收到同步文件通知消息之后,获知需要进行文件的同步,由于待同步设备需要通过特定的端口进行文件传输,因此待同步设备会将待同步设备的文件传输端口信息添加至同步文件响应消息中,并向第一设备发送同步文件响应消息。第一设备接收待同步设备发送的同步文件响应消息,并通过解析同步文件响应消息,获知待同步设备进行文件传输时所使用的文件传输端口信息。In the embodiment of this application, after receiving the synchronization file notification message, the device to be synchronized learns that the file needs to be synchronized. Since the device to be synchronized needs to perform file transmission through a specific port, the device to be synchronized will transfer the file of the device to be synchronized. The transmission port information is added to the synchronization file response message, and the synchronization file response message is sent to the first device. The first device receives the synchronization file response message sent by the device to be synchronized, and by parsing the synchronization file response message, learns the file transfer port information used by the device to be synchronized for file transmission.

作为一种可能的实现方式,当存在至少两个待同步设备时,每个待同步设备都会向第一设备返回同步文件响应消息,第一设备接收至少两个待同步设备发送的同步文件响应消息,并通过分别解析至少两个待同步设备发送的同步文件响应消息,获知每个待同步设备的文件传输端口信息。As a possible implementation, when there are at least two devices to be synchronized, each device to be synchronized will return a synchronization file response message to the first device, and the first device receives the synchronization file response message sent by at least two devices to be synchronized. , and obtain the file transfer port information of each device to be synchronized by respectively parsing the synchronization file response messages sent by at least two devices to be synchronized.

步骤S504、第一设备获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息中确定是否存在第二设备的子网信息及已完成同步的文件信息。Step S504: The first device obtains the record information of the synchronization file, and determines whether there is the subnet information of the second device and the completed synchronization in the record information of the synchronization file based on the subnet information of the device to be synchronized and the file information to be synchronized. File information.

具体可参考步骤S202,在此不再赘述。For details, reference may be made to step S202, which will not be described again here.

需要说明的是,第一设备在同步文件的记录信息中确定是否存在第二设备的子网信息及已完成同步的文件信息时,根据确定的结果不同,下述执行的步骤不同。在确定存在第二设备的子网信息及已完成同步的文件信息时,执行步骤S505a至步骤S507a,步骤S508,步骤S509a及步骤S510;当确定不存在第二设备的子网信息及已完成同步的文件信息时,执行步骤S505b、步骤S508及步骤S510。It should be noted that when the first device determines whether the subnet information of the second device and the synchronized file information exist in the record information of the synchronization file, the following steps are different depending on the determination result. When it is determined that the subnet information of the second device and the file information that has been synchronized exist, steps S505a to S507a, step S508, step S509a and step S510 are executed; when it is determined that the subnet information of the second device does not exist and the synchronization has been completed. When the file information is obtained, step S505b, step S508 and step S510 are executed.

步骤S505a、若存在,第一设备向第二设备发送同步控制指令,第二设备接收同步控制指令。Step S505a: If it exists, the first device sends a synchronization control instruction to the second device, and the second device receives the synchronization control instruction.

其中,同步控制指令中携带有待同步设备的文件传输端口信息。The synchronization control instruction carries file transfer port information of the device to be synchronized.

具体的,若确定存在第二设备的子网信息及已完成同步的文件信息,则说明第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同,即为,第二设备已经同步完成了待同步设备,且第二设备与待同步设备属于相同的子网。此时可以由第二设备向待同步设备传输同步文件。当第一设备接收到待同步设备发送的同步文件响应消息之后,通过解析同步文件响应消息可以获知待同步设备的文件传输端口信息,并将待同步设备的文件传输端口信息添加至同步控制指令中。第一设备向第二设备发送同步控制指令,第二设备接收同步控制指令,第二设备可以通过解析同步控制指令,获取到待同步设备的文件传输端口信息。Specifically, if it is determined that the subnet information of the second device and the file information that has been synchronized exist, it means that the subnet information of the second device and the file information that has been synchronized are the same as the subnet information of the device to be synchronized and the file to be synchronized. The information is the same, that is, the second device has completed synchronization with the device to be synchronized, and the second device and the device to be synchronized belong to the same subnet. At this time, the synchronization file can be transmitted from the second device to the device to be synchronized. After the first device receives the synchronization file response message sent by the device to be synchronized, it can learn the file transfer port information of the device to be synchronized by parsing the synchronization file response message, and adds the file transfer port information of the device to be synchronized to the synchronization control instruction. . The first device sends a synchronization control instruction to the second device, and the second device receives the synchronization control instruction. The second device can obtain the file transfer port information of the device to be synchronized by parsing the synchronization control instruction.

作为一种可能的实现方式,上述若存在至少两个第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同,则获取至少两个第二设备的负载信息;根据至少两个第二设备的负载信息,确定目标第二设备,向目标第二设备发送同步控制指令。As a possible implementation method, if there are at least two second devices whose subnet information and synchronized file information are the same as those of the device to be synchronized and file information to be synchronized, then at least two second devices are obtained. Load information of the two devices; determine the target second device based on the load information of at least two second devices, and send a synchronization control instruction to the target second device.

具体的,由于可能存在至少两个第二设备与待同步设备所属子网相同,且已完成待同步文件的同步,那么在同步文件的记录信息中会记录有至少两个第二设备的子网信息及已完成同步的文件信息,因此第一设备在同步文件的记录信息中会确定出至少两个第二设备的子网信息及已完成同步的文件信息。当存在至少两个第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同时,需要在至少两个第二设备中选择一个目标第二设备,用于向待同步设备同步待同步文件。Specifically, since there may be at least two second devices in the same subnet as the device to be synchronized, and the synchronization of the file to be synchronized has been completed, the subnets of at least two second devices will be recorded in the record information of the synchronization file. information and synchronized file information, so the first device will determine the subnet information and synchronized file information of at least two second devices in the record information of the synchronized file. When there are at least two second devices whose subnet information and synchronized file information are the same as those of the device to be synchronized and file information to be synchronized, a target second device needs to be selected among the at least two second devices. Device, used to synchronize files to be synchronized to the device to be synchronized.

此时,第一设备可以获取至少两个第二设备的负载信息,其中,第二设备的负载信息可以是第二设备需执行的文件同步任务的数量。例如,第一设备可以在同步文件的记录信息中获取至少两个第二设备的标识信息,根据至少两个第二设备的标识信息,向至少两个第二设备分别发送负载信息获取请求消息,至少两个第二设备中的每个第二设备在接收到负载信息获取请求消息之后,向第一设备发送自身的负载信息。还可以是,各个子网中的设备可以周期性向第一设备主动发送自身的负载信息,第一设备在接收到设备负载信息时,可以记录每个设备的标识信息及每个设备对应的负载信息,第一设备可以根据至少两个第二设备的标识信息,在记录的设备负载信息中,确定至少两个第二设备中的每个第二设备对应的负载信息。还可以是,第一设备可以记录每个设备的负载信息,每个设备的负载信息的初始值均为零,由于设备的文件同步任务均为第一设备向其发送的,因此第一设备每发送一次文件同步任务,便更新一次该文件同步任务对应的设备的负载信息,第一设备可以在记录的设备的负载信息中获取到至少两个第二设备中的每个第二设备对应的负载信息。当然,还可以通过其他方式获取第二设备对应的负载信息,本申请对此不作限制。At this time, the first device may obtain load information of at least two second devices, where the load information of the second device may be the number of file synchronization tasks that the second device needs to perform. For example, the first device may obtain the identification information of at least two second devices from the record information of the synchronization file, and send load information acquisition request messages to the at least two second devices respectively based on the identification information of the at least two second devices, After receiving the load information acquisition request message, each of the at least two second devices sends its own load information to the first device. Alternatively, the devices in each subnet can periodically actively send their own load information to the first device. When receiving the device load information, the first device can record the identification information of each device and the load information corresponding to each device. The first device may determine the load information corresponding to each of the at least two second devices in the recorded device load information based on the identification information of the at least two second devices. Alternatively, the first device may record the load information of each device, and the initial value of the load information of each device is zero. Since the file synchronization tasks of the device are all sent to it by the first device, the first device can Sending a file synchronization task once will update the load information of the device corresponding to the file synchronization task. The first device can obtain the load corresponding to each of at least two second devices from the recorded load information of the device. information. Of course, the load information corresponding to the second device can also be obtained through other methods, and this application does not limit this.

当获取到至少两个第二设备的负载信息之后,可以根据至少两个第二设备的负载信息,确定目标第二设备。此时,第一设备根据至少两个第二设备的负载信息,可以获取到每个第二设备需执行的文件同步任务的数量,为实现至少两个第二设备间的负载均衡,可以将需执行的文件同步的数量较少的第二设备确定为目标第二设备,从而实现至少两个第二设备间的负载均衡。当至少两个第二设备的负载信息相同时,可以在负载信息相同的至少两个第二设备中随机选取一个第二设备作为目标第二设备。在确定出目标第二设备之后,向目标第二设备发送同步控制指令。After obtaining the load information of at least two second devices, the target second device may be determined based on the load information of the at least two second devices. At this time, the first device can obtain the number of file synchronization tasks that each second device needs to perform based on the load information of at least two second devices. In order to achieve load balancing between at least two second devices, the required The second device that performs file synchronization with a smaller number is determined as the target second device, thereby achieving load balancing between at least two second devices. When the load information of at least two second devices is the same, one second device may be randomly selected as the target second device from the at least two second devices with the same load information. After the target second device is determined, a synchronization control instruction is sent to the target second device.

作为一种可能的实现方式,当存在至少两个待同步设备时,上述根据至少两个第二设备的负载信息,确定目标第二设备包括:针对至少两个待同步设备中的每个待同步设备,根据至少两个第二设备的负载信息,确定每个待同步设备对应的目标第二设备。As a possible implementation manner, when there are at least two devices to be synchronized, determining the target second device based on the load information of the at least two second devices includes: for each of the at least two devices to be synchronized, The device determines the target second device corresponding to each device to be synchronized based on the load information of at least two second devices.

在本申请实施例中,由于每个子网中可能存在多个同类型的设备,例如子网2中包括多个液压支架设备,多个同类型设备需要同步的文件相同,因此第一设备获取到待同步文件后,会存在多个设备都需要同步该待同步文件。第一设备根据存储的设备相关信息,会确定出至少两个待同步设备。并且第一设备若确定出至少两个第二设备时,针对至少两个待同步设备中的每个待同步设备,第一设备可以根据至少两个第二设备的负载信息,以负载均衡为准则,确定每个待同步设备对应的目标第二设备。即为,若存在至少两个待同步设备及至少两个第二设备,则针对至少两个待同步设备中的每个待同步设备,根据至少两个第二设备的负载信息,可以确定每个第二设备需执行的文件同步任务的数量,以实现至少两个第二设备的负载均衡为原则,确定每个待同步设备对应的目标第二设备。其中,至少两个第二设备负载均衡即为至少两个第二设备需执行的文件同步任务的数量相对均衡。In the embodiment of this application, since there may be multiple devices of the same type in each subnet, for example, subnet 2 includes multiple hydraulic support devices, and multiple devices of the same type need to synchronize the same files, so the first device obtains After the file is synchronized, there will be multiple devices that need to synchronize the file to be synchronized. The first device determines at least two devices to be synchronized based on the stored device-related information. And if the first device determines at least two second devices, for each of the at least two devices to be synchronized, the first device can use load balancing as a criterion based on the load information of the at least two second devices. , determine the target second device corresponding to each device to be synchronized. That is, if there are at least two devices to be synchronized and at least two second devices, then for each device to be synchronized in the at least two devices to be synchronized, each device can be determined based on the load information of the at least two second devices. The number of file synchronization tasks that the second device needs to perform is based on the principle of achieving load balancing of at least two second devices, and the target second device corresponding to each device to be synchronized is determined. The load balancing of at least two second devices means that the number of file synchronization tasks to be performed by at least two second devices is relatively balanced.

例如,假设第一设备所属子网为子网1,并且存在两个待同步设备:设备1、设备2,第一设备根据待同步设备的子网信息及待同步的文件信息确定出两个第二设备:设备3、设备4,设备1、设备2、设备3及设备4所属子网均为子网2。第一设备获取到的设备3的负载信息包括需执行的文件同步任务的数量为2,设备4的负载信息包括需执行的文件同步任务的数量为4。在确定两个待同步设备:设备1、设备2对应的目标第二设备时,为实现两个第二设备间的负载均衡,可以将第一个待同步设备(设备1)对应的目标第二设备确定为设备3,将第二个待同步设备(设备2)对应的目标第二设备也确定为设备3,这样一来,设备3需执行的文件同步任务的数量及设备4需执行的文件同步任务的数量均为4,从而可以实现设备3和设备4间的负载均衡。假设设备3的负载信息包括需执行的文件同步任务的数量为2,设备4的负载信息包括需执行的文件同步任务的数量为3,为实现两个第二设备间的负载均衡,可以将第一个待同步设备(设备1)对应的目标第二设备确定为设备3,此时,设备3需执行的文件同步任务的数量及设备4需执行的文件同步任务的数量将均为3,在确定第二个待同步设备(设备2)对应的目标第二设备时,可以随机选取设备3及设备4中的一个设备作为第二个待同步设备的目标第二设备。For example, assume that the subnet to which the first device belongs is subnet 1, and there are two devices to be synchronized: device 1 and device 2. The first device determines the two devices based on the subnet information of the device to be synchronized and the file information to be synchronized. Two devices: device 3 and device 4. The subnets to which device 1, device 2, device 3 and device 4 belong are all subnet 2. The load information of device 3 obtained by the first device includes the number of file synchronization tasks that need to be executed, which is 2, and the load information of device 4 includes the number of file synchronization tasks that need to be executed, which is 4. When determining the target second device corresponding to two devices to be synchronized: device 1 and device 2, in order to achieve load balancing between the two second devices, the target second device corresponding to the first device to be synchronized (device 1) can be The device is determined as device 3, and the target second device corresponding to the second device to be synchronized (device 2) is also determined as device 3. In this way, the number of file synchronization tasks that need to be executed by device 3 and the files that need to be executed by device 4 The number of synchronization tasks is 4, so that load balancing between device 3 and device 4 can be achieved. Assume that the load information of device 3 includes the number of file synchronization tasks that need to be executed, which is 2, and the load information of device 4 includes that the number of file synchronization tasks that need to be executed is 3. In order to achieve load balancing between the two second devices, the second device can be The target second device corresponding to a device to be synchronized (device 1) is determined to be device 3. At this time, the number of file synchronization tasks that device 3 needs to perform and the number of file synchronization tasks that device 4 needs to perform will both be 3. When determining the target second device corresponding to the second device to be synchronized (device 2), one of device 3 and device 4 may be randomly selected as the target second device of the second device to be synchronized.

步骤S505b、若不存在,第一设备根据待同步的文件信息获取待同步文件,并向待同步设备发送待同步文件,待同步设备接收待同步文件。Step S505b: If it does not exist, the first device obtains the file to be synchronized based on the file information to be synchronized, and sends the file to be synchronized to the device to be synchronized, and the device to be synchronized receives the file to be synchronized.

具体的,若同步文件的记录信息中不存在第二设备的子网信息及已完成同步的文件信息,说明第一设备未向与待同步设备的子网信息相同的其他设备同步过待同步文件,第一设备无法通过与待同步设备处于同一子网中的设备向待同步设备同步待同步文件。此时第一设备需要直接向待同步设备同步待同步文件。第一设备可以根据待同步的文件信息获取待同步文件,并向待同步设备发送待同步文件。Specifically, if the subnet information of the second device and the synchronized file information do not exist in the record information of the synchronized file, it means that the first device has not synchronized the file to be synchronized with other devices that have the same subnet information as the device to be synchronized. , the first device cannot synchronize the file to be synchronized to the device to be synchronized through a device in the same subnet as the device to be synchronized. At this time, the first device needs to directly synchronize the file to be synchronized with the device to be synchronized. The first device can obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.

例如,第一设备可能从其他设备或者通过其他方式获取到多个需同步的文件并存储,第一设备可以根据待同步的文件信息,在多个需同步的文件中确定出待同步文件。For example, the first device may obtain and store multiple files that need to be synchronized from other devices or through other methods. The first device may determine the files to be synchronized among the multiple files that need to be synchronized based on the file information to be synchronized.

作为一种可能的实现方式,由于待同步设备向第一设备返回的同步文件响应消息中携带有待同步设备的文件传输端口信息,因此,在确定同步文件的记录信息中不存在第二设备的子网信息及已完成同步的文件信息时,第一设备可以通过获取的待同步设备的文件传输端口信息指示的文件传输端口向待同步设备发送待同步文件,待同步设备通过文件传输端口接收待同步文件。As a possible implementation manner, since the synchronization file response message returned by the device to be synchronized to the first device carries the file transfer port information of the device to be synchronized, therefore, it is determined that the record information of the synchronization file does not include the second device's sub-register. When the network information and the synchronized file information are obtained, the first device can send the file to be synchronized to the device to be synchronized through the file transfer port indicated by the obtained file transfer port information of the device to be synchronized, and the device to be synchronized receives the file to be synchronized through the file transfer port. document.

步骤S506a、第二设备根据同步控制指令,确定待同步的文件信息及待同步设备。Step S506a: The second device determines the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.

具体可参考步骤S302,在此不再赘述。For details, reference may be made to step S302, which will not be described again here.

步骤S507a、第二设备通过文件传输端口信息指示的端口向待同步设备发送待同步文件,待同步设备通过文件传输端口信息指示的端口接收待同步文件。Step S507a: The second device sends the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information, and the device to be synchronized receives the file to be synchronized through the port indicated by the file transfer port information.

具体的,第一设备向第二设备发送的同步控制指令中会携带有待同步设备的文件传输端口信息,第二设备通过解析同步控制指令,可以得到同步控制指令中携带的待同步设备进行文件传输时使用的端口。第二设备在向待同步设备发送待同步文件时,便可以通过文件传输端口信息指示的端口向待同步设备发送待同步文件,待同步设备通过文件传输端口信息指示的端口接收第二设备发送的待同步文件。Specifically, the synchronization control command sent by the first device to the second device will carry the file transfer port information of the device to be synchronized. By parsing the synchronization control command, the second device can obtain the device to be synchronized carried in the synchronization control command for file transfer. The port used. When the second device sends the file to be synchronized to the device to be synchronized, it can send the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information, and the device to be synchronized receives the file sent by the second device through the port indicated by the file transfer port information. Files to be synchronized.

假设,如图6所示,第一设备所属子网为子网1,第一设备获取到待同步文件,例如待同步文件为文件1,根据待同步的文件信息(文件1),在其存储的设备相关信息中确定出有两个待同步设备(设备1、设备2)中配置有文件1,其中设备1及设备2的子网信息均为子网2。也就是说,第一设备可以确定两个待同步设备都需要同步该待同步文件。第一设备向两个待同步设备(设备1、设备2)分别发送同步文件通知消息,以告知设备1、设备2需要向其传输待同步文件。然后设备1向第一设备返回同步文件响应消息,设备1返回的同步文件响应消息中携带有设备1的文件传输端口信息。同时,设备2向第一设备返回同步文件响应消息,设备2返回的同步文件响应消息中携带有设备2的文件传输端口信息。第一设备通过解析接收到的两个待同步设备返回的同步文件响应消息,可以获知两个待同步设备进行文件传输使用的端口。Assume that, as shown in Figure 6, the subnet to which the first device belongs is subnet 1. The first device obtains the file to be synchronized. For example, the file to be synchronized is file 1. According to the file information to be synchronized (file 1), it stores From the device-related information, it is determined that two devices to be synchronized (device 1 and device 2) are configured with file 1, and the subnet information of device 1 and device 2 is both subnet 2. That is to say, the first device can determine that both devices to be synchronized need to synchronize the file to be synchronized. The first device sends synchronization file notification messages to the two devices to be synchronized (device 1 and device 2) respectively to inform device 1 and device 2 that the files to be synchronized need to be transmitted to them. Then device 1 returns a synchronization file response message to the first device, and the synchronization file response message returned by device 1 carries the file transfer port information of device 1. At the same time, device 2 returns a synchronization file response message to the first device, and the synchronization file response message returned by device 2 carries the file transfer port information of device 2. By parsing the received synchronization file response messages returned by the two devices to be synchronized, the first device can learn the ports used by the two devices to be synchronized for file transmission.

然后,第一设备根据待同步设备的子网信息(子网2)及待同步的文件信息(文件1),在同步文件的记录信息中确定出存在两个第二设备(设备3、设备4),也就是说,设备3及设备4都已经同步完成文件1,并且所属子网均为子网2,与待同步设备所属子网相同。由于存在两个第二设备,因此第一设备可以向设备3和设备4分别发送获取其负载信息的请求消息,并接收设备3、设备4返回的各自的负载信息。假设设备3的负载信息包括需执行的文件同步任务的数量为3,设备4的负载信息包括需执行的文件同步任务的数量为3。因此,为实现两个第二设备间的负载均衡,可以将第一个待同步设备(设备1)对应的目标第二设备确定为设备3,将第二个待同步设备(设备2)对应的目标第二设备确定为设备4,这样一来,设备3需执行的文件同步任务的数量及设备4需执行的文件同步任务的数量均为4,从而可以实现设备3和设备4间的负载均衡。然后,第一设备向设备3发送同步控制指令,其中,同步控制指令中包括待同步设备为设备1、设备1的文件传输端口信息及待同步的文件信息为文件1;同时,第一设备向设备4发送同步控制指令,其中,同步控制指令中包括待同步设备为设备2、设备2的文件传输端口信息及待同步的文件信息为文件1。设备3接收到同步控制指令之后,根据同步控制指令中携带的待同步的文件信息,获取到已存储的待同步文件,并通过同步控制指令中携带的设备1的文件传输端口向待同步设备(设备1)传输待同步文件,设备1通过文件传输端口信息指示的端口接收待同步文件。同理,设备4接收到同步控制指令之后,根据同步控制指令中携带的待同步的文件信息,获取到已存储的待同步文件,并通过同步控制指令中携带的设备2的文件传输端口向待同步设备(设备2)传输待同步文件,设备2通过文件传输端口信息指示的端口接收待同步文件。Then, based on the subnet information of the device to be synchronized (subnet 2) and the file information to be synchronized (file 1), the first device determines that there are two second devices (device 3, device 4) in the record information of the synchronization file. ), that is to say, both device 3 and device 4 have completed synchronizing file 1, and both belong to subnet 2, which is the same as the subnet to which the device to be synchronized belongs. Since there are two second devices, the first device can send request messages to obtain their load information to device 3 and device 4 respectively, and receive the respective load information returned by device 3 and device 4. Assume that the load information of device 3 includes the number of file synchronization tasks that need to be executed, which is 3, and the load information of device 4 includes that the number of file synchronization tasks that need to be executed is 3. Therefore, in order to achieve load balancing between the two second devices, the target second device corresponding to the first device to be synchronized (device 1) can be determined as device 3, and the target second device corresponding to the second device to be synchronized (device 2) can be determined. The target second device is determined to be device 4. In this way, the number of file synchronization tasks that device 3 needs to perform and the number of file synchronization tasks that device 4 needs to perform are both 4, thus achieving load balancing between device 3 and device 4. . Then, the first device sends a synchronization control instruction to device 3, where the synchronization control instruction includes that the device to be synchronized is device 1, the file transfer port information of device 1, and the file information to be synchronized is file 1; at the same time, the first device sends Device 4 sends a synchronization control instruction, where the synchronization control instruction includes that the device to be synchronized is device 2, the file transmission port information of device 2 and the file information to be synchronized is file 1. After receiving the synchronization control instruction, device 3 obtains the stored file to be synchronized based on the file information to be synchronized carried in the synchronization control instruction, and transmits the file to the device to be synchronized ( Device 1) transmits the file to be synchronized, and device 1 receives the file to be synchronized through the port indicated by the file transfer port information. In the same way, after receiving the synchronization control command, device 4 obtains the stored file to be synchronized based on the file information to be synchronized carried in the synchronization control command, and transmits the file to the file to be synchronized through the file transfer port of device 2 carried in the synchronization control command. The synchronization device (device 2) transmits the file to be synchronized, and device 2 receives the file to be synchronized through the port indicated by the file transfer port information.

步骤S508、待同步设备根据待同步文件,更新相应的文件。Step S508: The device to be synchronized updates the corresponding file according to the file to be synchronized.

具体可参考步骤S402,在此不再赘述。For details, reference may be made to step S402, which will not be described again here.

步骤S509a、第二设备向第一设备发送同步完成响应消息,第一设备接收第二设备返回的同步完成响应消息。Step S509a: The second device sends a synchronization completion response message to the first device, and the first device receives the synchronization completion response message returned by the second device.

具体的,当第二设备向待同步设备传输完待同步文件之后,可以向第一设备返回同步完成响应消息,以告知第一设备以完成向待同步设备进行待同步文件的同步。第一设备接收同步完成响应消息,可以根据同步完成响应消息获知第二设备已经向待同步设备传输完待同步文件,文件同步完成。Specifically, after the second device completes transmitting the file to be synchronized to the device to be synchronized, the second device may return a synchronization completion response message to the first device to inform the first device to complete synchronization of the file to be synchronized to the device to be synchronized. The first device receives the synchronization completion response message, and can learn based on the synchronization completion response message that the second device has completed transmitting the file to be synchronized to the device to be synchronized, and the file synchronization is completed.

步骤S510、第一设备根据待同步设备的子网信息及待同步的文件信息,更新同步文件的记录信息。Step S510: The first device updates the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.

在本申请实施例中,第一设备会记录每次完成同步文件时的设备的子网信息及已完成同步的文件信息,即为每次完成同步文件时的设备的子网信息及已完成同步的文件信息时可以更新同步文件的记录信息。在接收到第二设备返回的同步完成响应消息之后,第一设备确定已经完成文件同步,此时根据待同步设备的子网信息及待同步的文件信息,更新同步文件的记录信息。例如,可以将待同步设备的标识信息、待同步设备的子网信息及待同步的文件信息添加至同步文件的记录信息中。In this embodiment of the present application, the first device will record the subnet information of the device and the file information that has been synchronized each time the file is synchronized, that is, the subnet information of the device and the synchronized file information that has been completed each time the file is synchronized. The record information of the synchronized file can be updated when the file information is obtained. After receiving the synchronization completion response message returned by the second device, the first device determines that file synchronization has been completed. At this time, the record information of the synchronized file is updated according to the subnet information of the device to be synchronized and the file information to be synchronized. For example, the identification information of the device to be synchronized, the subnet information of the device to be synchronized, and the file information to be synchronized can be added to the record information of the synchronization file.

本申请实施例中以待同步设备主动向第一设备请求进行文件同步为例进行说明,如图7所示,为本申请实施例提供的另一种文件同步方法的流程示意图。具体包括如下步骤:In this embodiment of the present application, the device to be synchronized actively requests the first device for file synchronization as an example. As shown in Figure 7, it is a schematic flow chart of another file synchronization method provided by this embodiment of the present application. Specifically, it includes the following steps:

步骤S701、待同步设备向第一设备发送同步文件请求消息,第一设备接收同步文件请求消息。Step S701: The device to be synchronized sends a synchronization file request message to the first device, and the first device receives the synchronization file request message.

其中,同步文件请求消息中携带有子网信息及待同步的文件信息。The synchronization file request message carries subnet information and file information to be synchronized.

在本申请实施例中,待同步设备可以主动向第一设备请求同步文件,此时,待同步设备可以向第一设备发送同步文件请求消息,第一设备接收待同步设备发送的同步文件请求消息。In this embodiment of the present application, the device to be synchronized can actively request synchronization files from the first device. At this time, the device to be synchronized can send a synchronization file request message to the first device, and the first device receives the synchronization file request message sent by the device to be synchronized. .

作为一种可能的实现方式,同步文件请求消息还携带有待同步设备的文件传输端口信息。As a possible implementation method, the synchronization file request message also carries the file transfer port information of the device to be synchronized.

其中,文件传输端口信息用于指示待同步设备进行文件传输时使用的端口。The file transfer port information is used to indicate the port used by the device to be synchronized for file transfer.

在一些实施例中,由于待同步设备需要通过指定的端口进行文件传输,因此,待同步设备可以将文件传输端口信息添加至同步文件请求消息中,并向第一设备发送同步文件请求消息,以告知第一设备待同步设备的文件传输端口。In some embodiments, since the device to be synchronized needs to perform file transfer through a specified port, the device to be synchronized can add the file transfer port information to the synchronization file request message and send the synchronization file request message to the first device to Inform the first device of the file transfer port of the device to be synchronized.

步骤S702、第一设备向待同步设备发送同步文件响应消息,待同步设备接收同步文件响应消息。Step S702: The first device sends a synchronization file response message to the device to be synchronized, and the device to be synchronized receives the synchronization file response message.

在本申请实施例中,第一设备在接收到待同步设备发送的同步文件响应消息之后,若可以为待同步设备进行文件同步,则可以向待同步设备发送同步文件响应消息,待同步设备接收同步文件响应消息,从而获知第一设备同意为其进行文件同步。In this embodiment of the present application, after receiving the synchronization file response message sent by the device to be synchronized, if the first device can perform file synchronization for the device to be synchronized, it can send the synchronization file response message to the device to be synchronized, and the device to be synchronized receives the synchronization file response message. Synchronize the file response message, thereby learning that the first device agrees to perform file synchronization for it.

步骤S703、第一设备从同步文件请求消息中获取待同步设备的子网信息及待同步的文件信息。Step S703: The first device obtains the subnet information of the device to be synchronized and the file information to be synchronized from the synchronization file request message.

在本申请实施例中,同步文件请求消息中携带有子网信息及待同步的文件信息,第一设备通过解析同步文件请求消息,可以获知同步文件请求消息中携带的待同步设备的子网信息及待同步的文件信息。In the embodiment of this application, the synchronization file request message carries subnet information and file information to be synchronized. By parsing the synchronization file request message, the first device can learn the subnet information of the device to be synchronized carried in the synchronization file request message. and file information to be synchronized.

作为一种可能的实现方式,当待同步设备发送的同步文件请求消息还携带有待同步设备的文件传输端口信息时,第一设备通过解析待同步设备发送的同步文件请求消息,可以获知待同步设备进行文件传输时使用的端口。As a possible implementation, when the synchronization file request message sent by the device to be synchronized also carries the file transfer port information of the device to be synchronized, the first device can learn the device to be synchronized by parsing the synchronization file request message sent by the device to be synchronized. The port to use for file transfers.

步骤S704、第一设备获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息中确定是否存在第二设备的子网信息及已完成同步的文件信息。Step S704: The first device obtains the record information of the synchronization file, and determines whether there is the subnet information of the second device and the completed synchronization in the record information of the synchronization file based on the subnet information of the device to be synchronized and the file information to be synchronized. File information.

具体可参考步骤S202,在此不再赘述。当确定存在第二设备的子网信息及已完成同步的文件信息时,执行步骤S705a至步骤S707a,步骤S708,步骤S709a及步骤S710;当确定不存在第二设备的子网信息及已完成同步的文件信息时,执行步骤S705b、步骤S708及步骤S710。For details, reference may be made to step S202, which will not be described again here. When it is determined that the subnet information of the second device and the file information that have been synchronized exist, perform steps S705a to S707a, step S708, step S709a and step S710; when it is determined that the subnet information of the second device does not exist and the synchronization has been completed. When the file information is obtained, execute step S705b, step S708 and step S710.

步骤S705a、若存在,则向第二设备发送同步控制指令,第二设备接收同步控制指令。Step S705a: If it exists, send the synchronization control instruction to the second device, and the second device receives the synchronization control instruction.

具体可参考步骤S505a,在此不再赘述。For details, reference may be made to step S505a, which will not be described again here.

需要说明的是,在待同步设备主动向第一设备请求进行文件同步时,也可能存在至少两个第二设备,在存在至少两个第二设备时,具体执行步骤可参考步骤S505a。It should be noted that when the device to be synchronized actively requests the first device for file synchronization, there may also be at least two second devices. When there are at least two second devices, the specific execution steps may refer to step S505a.

步骤S705b、若不存在,第一设备根据待同步的文件信息获取待同步文件,并向待同步设备发送待同步文件,待同步设备接收待同步文件。Step S705b: If it does not exist, the first device obtains the file to be synchronized based on the file information to be synchronized, and sends the file to be synchronized to the device to be synchronized, and the device to be synchronized receives the file to be synchronized.

具体可参考步骤S505b,在此不再赘述。For details, please refer to step S505b, which will not be described again here.

步骤S706a、第二设备根据同步控制指令,确定待同步的文件信息及待同步设备。Step S706a: The second device determines the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.

具体可参考步骤S302,在此不再赘述。For details, reference may be made to step S302, which will not be described again here.

步骤S707a、第二设备通过文件传输端口信息指示的端口向待同步设备发送待同步文件,待同步设备通过文件传输端口信息指示的端口接收待同步文件。Step S707a: The second device sends the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information, and the device to be synchronized receives the file to be synchronized through the port indicated by the file transfer port information.

具体可参考步骤S507a,在此不再赘述。For details, reference may be made to step S507a, which will not be described again here.

步骤S708、待同步设备根据待同步文件,更新相应的文件。Step S708: The device to be synchronized updates the corresponding file according to the file to be synchronized.

具体可参考步骤S402,在此不再赘述。For details, reference may be made to step S402, which will not be described again here.

步骤S709a、第二设备向第一设备发送同步完成响应消息,第一设备接收第二设备返回的同步完成响应消息。Step S709a: The second device sends a synchronization completion response message to the first device, and the first device receives the synchronization completion response message returned by the second device.

具体可参考步骤S509a,在此不再赘述。For details, reference may be made to step S509a, which will not be described again here.

步骤S710、第一设备根据待同步设备的子网信息及待同步的文件信息,更新同步文件的记录信息。Step S710: The first device updates the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.

具体可参考步骤S510,在此不再赘述。For details, reference may be made to step S510, which will not be described again here.

这样一来,根据上述图5或图7所述的方法,在第一设备需要向待同步设备同步文件时,若第一设备所属子网与待同步设备所属子网不同,而第二设备与待同步设备所属子网相同,并且第二设备已经同步过待同步设备需要同步的文件,那么第一设备可以调度第二设备向待同步设备发送待同步文件。由于第二设备所属子网与待同步设备所属子网相同,因此相对于第一设备直接对待同步设备进行跨子网传输待同步文件,由第二设备向待同步设备传输待同步文件的速度更快,效率更高。并且,相对于P2P技术,采用上述实施例所述方法无需进行NAT探测和NAT穿越,可以降低文件同步的复杂度。同时,对于同一子网下的第二设备及待同步设备,第二设备可以直接向待同步设备发送待同步文件,无需NAT穿越便可以实现同一子网下的设备间的文件传输。In this way, according to the method described in Figure 5 or Figure 7 above, when the first device needs to synchronize files with the device to be synchronized, if the subnet to which the first device belongs is different from the subnet to which the device to be synchronized belongs, and the second device is different from the subnet to which the device to be synchronized belongs. If the devices to be synchronized belong to the same subnet, and the second device has synchronized the files that the device to be synchronized needs to synchronize, then the first device can schedule the second device to send the files to be synchronized to the device to be synchronized. Since the subnet to which the second device belongs is the same as the subnet to which the device to be synchronized belongs, compared to the first device directly transmitting the file to be synchronized across subnets to the device to be synchronized, the speed at which the second device transmits the file to be synchronized to the device to be synchronized is faster. Faster and more efficient. Moreover, compared with P2P technology, the method described in the above embodiment does not require NAT detection and NAT traversal, and can reduce the complexity of file synchronization. At the same time, for the second device under the same subnet and the device to be synchronized, the second device can directly send the file to be synchronized to the device to be synchronized, and file transfer between devices under the same subnet can be realized without NAT traversal.

图8为本申请实施例提供的一种文件同步装置的结构示意图。如图8所示,该装置包括:Figure 8 is a schematic structural diagram of a file synchronization device provided by an embodiment of the present application. As shown in Figure 8, the device includes:

获取单元801,用于获取待同步设备的子网信息及待同步的文件信息。The obtaining unit 801 is used to obtain the subnet information of the device to be synchronized and the file information to be synchronized.

处理单元802,用于获取同步文件的记录信息,并根据待同步设备的子网信息及待同步的文件信息在同步文件的记录信息确定是否存在第二设备的子网信息及已完成同步的文件信息。The processing unit 802 is used to obtain the record information of the synchronization file, and determine whether there is subnet information of the second device and the files that have been synchronized based on the subnet information of the device to be synchronized and the file information to be synchronized in the synchronization file. information.

其中,第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同,同步文件的记录信息用于记录已完成文件同步的设备的子网信息及已完成同步的文件信息。Among them, the subnet information of the second device and the file information that has completed synchronization are the same as the subnet information and file information of the device to be synchronized. The record information of the synchronization file is used to record the subnet information of the device that has completed file synchronization. and file information that has been synchronized.

处理单元802,还用于,若存在,则向第二设备发送同步控制指令。同步控制指令用于指示第二设备向待同步设备传输待同步文件。The processing unit 802 is also configured to, if present, send a synchronization control instruction to the second device. The synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.

作为一种可能的实现方式,如图9所示,所述文件同步装置还包括:As a possible implementation, as shown in Figure 9, the file synchronization device further includes:

接收单元803,用于接收第二设备返回的同步完成响应消息。The receiving unit 803 is configured to receive the synchronization completion response message returned by the second device.

处理单元802,还用于根据待同步设备的子网信息及待同步的文件信息,更新同步文件的记录信息。The processing unit 802 is also configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.

作为一种可能的实现方式,接收单元803,还用于接收待同步设备发送的同步文件请求消息;同步文件请求消息中携带有子网信息及待同步的文件信息;As a possible implementation, the receiving unit 803 is also used to receive a synchronization file request message sent by the device to be synchronized; the synchronization file request message carries subnet information and file information to be synchronized;

处理单元802,还用于向待同步设备发送同步文件响应消息。The processing unit 802 is also configured to send a synchronization file response message to the device to be synchronized.

获取单元801,具体用于从同步文件请求消息中获取待同步设备的子网信息及待同步的文件信息。The obtaining unit 801 is specifically configured to obtain the subnet information of the device to be synchronized and the file information to be synchronized from the synchronization file request message.

作为一种可能的实现方式,处理单元802,还用于向待同步设备发送同步文件通知消息;As a possible implementation, the processing unit 802 is also configured to send a synchronization file notification message to the device to be synchronized;

接收单元803,还用于接收待同步设备发送的同步文件响应消息;同步文件响应消息中携带有待同步设备的文件传输端口信息。The receiving unit 803 is also configured to receive a synchronization file response message sent by the device to be synchronized; the synchronization file response message carries the file transfer port information of the device to be synchronized.

作为一种可能的实现方式,处理单元802,具体用于若存在,且存在至少两个第二设备的子网信息及已完成同步的文件信息与待同步设备的子网信息及待同步的文件信息相同,则获取至少两个第二设备的负载信息。As a possible implementation, the processing unit 802 is specifically configured to, if there is, at least two subnet information and synchronized file information of the second device and subnet information of the device to be synchronized and files to be synchronized. If the information is the same, the load information of at least two second devices is obtained.

根据所述至少两个第二设备的负载信息,确定目标第二设备,向所述目标第二设备发送同步控制指令。Determine a target second device according to the load information of the at least two second devices, and send a synchronization control instruction to the target second device.

作为一种可能的实现方式,处理单元802,具体用于针对至少两个待同步设备中的每个待同步设备,根据至少两个第二设备的负载信息,确定每个待同步设备对应的目标第二设备。As a possible implementation, the processing unit 802 is specifically configured to determine, for each of the at least two devices to be synchronized, a target corresponding to each device to be synchronized based on the load information of at least two second devices. Secondary device.

作为一种可能的实现方式,处理单元802,还用于若不存在,则根据待同步的文件信息获取待同步文件,并向待同步设备发送待同步文件。As a possible implementation manner, the processing unit 802 is also configured to obtain the file to be synchronized according to the file information to be synchronized if it does not exist, and send the file to be synchronized to the device to be synchronized.

处理单元802,还用于根据待同步设备的子网信息及待同步的文件信息,更新同步文件的记录信息。The processing unit 802 is also configured to update the record information of the synchronization file according to the subnet information of the device to be synchronized and the file information to be synchronized.

图10为本申请实施例提供的另一种文件同步装置的结构示意图。如图10所示,该装置包括:Figure 10 is a schematic structural diagram of another file synchronization device provided by an embodiment of the present application. As shown in Figure 10, the device includes:

接收单元1001,用于接收同步控制指令。同步控制指令用于指示第二设备向待同步设备传输待同步文件。The receiving unit 1001 is used to receive synchronization control instructions. The synchronization control instruction is used to instruct the second device to transmit the file to be synchronized to the device to be synchronized.

处理单元1002,用于根据同步控制指令,确定待同步的文件信息及待同步设备。The processing unit 1002 is configured to determine the file information to be synchronized and the device to be synchronized according to the synchronization control instruction.

处理单元1002,还用于根据待同步的文件信息获取待同步文件,并向待同步设备发送待同步文件。The processing unit 1002 is also configured to obtain the file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.

处理单元1002,还用于向第一设备发送同步完成响应消息。The processing unit 1002 is also configured to send a synchronization completion response message to the first device.

作为一种可能的实现方式,处理单元1002,具体用于通过文件传输端口信息指示的端口向待同步设备发送待同步文件。As a possible implementation manner, the processing unit 1002 is specifically configured to send the file to be synchronized to the device to be synchronized through the port indicated by the file transfer port information.

图11为本申请实施例提供的另一种文件同步装置的结构示意图。如图11所示,该装置包括:Figure 11 is a schematic structural diagram of another file synchronization device provided by an embodiment of the present application. As shown in Figure 11, the device includes:

接收单元1101,用于接收待同步文件。The receiving unit 1101 is used to receive files to be synchronized.

处理单元1102,用于根据待同步文件,更新相应的文件。The processing unit 1102 is used to update the corresponding files according to the files to be synchronized.

作为一种可能的实现方式,处理单元1102,还用于向第一设备发送同步文件请求消息。同步文件请求消息中携带有子网信息及待同步的文件信息。As a possible implementation manner, the processing unit 1102 is also configured to send a synchronization file request message to the first device. The synchronization file request message carries subnet information and file information to be synchronized.

接收单元1101,还用于接收第一设备发送的同步文件响应消息。The receiving unit 1101 is also configured to receive a synchronization file response message sent by the first device.

作为一种可能的实现方式,接收单元1101,还用于接收第一设备发送的同步文件通知消息。As a possible implementation manner, the receiving unit 1101 is also configured to receive a synchronization file notification message sent by the first device.

处理单元1102,还用于向第一设备发送同步文件响应消息,同步文件响应消息中携带有待同步设备的文件传输端口信息。The processing unit 1102 is also configured to send a synchronization file response message to the first device, where the synchronization file response message carries file transfer port information of the device to be synchronized.

作为一种可能的实现方式,处理单元1102,具体用于通过文件传输端口信息指示的端口接收待同步文件。As a possible implementation manner, the processing unit 1102 is specifically configured to receive the file to be synchronized through the port indicated by the file transfer port information.

与上述实施例相对应,本申请还提供了一种电子设备。图12为本发明实施例提供的一种电子设备的结构示意图,所述电子设备1200可以包括:处理器1201、存储器1202及通信单元1703。这些组件通过一条或多条总线进行通信,本领域技术人员可以理解,图中示出的服务器的结构并不构成对本发明实施例的限定,它既可以是总线形结构,也可以是星型结构,还可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Corresponding to the above embodiments, this application also provides an electronic device. FIG. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 1200 may include: a processor 1201, a memory 1202, and a communication unit 1703. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the embodiment of the present invention. It can be either a bus structure or a star structure. , may also include more or fewer components than shown, or combinations of certain components, or different component arrangements.

其中,所述通信单元1203,用于建立通信信道,从而使所述电子设备可以与其它设备进行通信。接收其他设备发送的用户数据或者向其他设备发送用户数据。The communication unit 1203 is used to establish a communication channel so that the electronic device can communicate with other devices. Receive user data from other devices or send user data to other devices.

所述处理器1201,为电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器1202内的软件程序和/或模块,以及调用存储在存储器内的数据,以执行电子设备的各种功能和/或处理数据。所述处理器可以由集成电路(integrated circuit,IC)组成,例如可以由单颗封装的IC所组成,也可以由连接多颗相同功能或不同功能的封装IC而组成。举例来说,处理器1201可以仅包括中央处理器(central processing unit,CPU)。在本发明实施方式中,CPU可以是单运算核心,也可以包括多运算核心。The processor 1201 is the control center of the electronic device, using various interfaces and lines to connect various parts of the entire electronic device, by running or executing software programs and/or modules stored in the memory 1202, and calling the software programs stored in the memory 1202. data to perform various functions of the electronic device and/or process data. The processor may be composed of an integrated circuit (IC), for example, it may be composed of a single packaged IC, or it may be composed of multiple packaged ICs connected with the same function or different functions. For example, the processor 1201 may only include a central processing unit (CPU). In the embodiment of the present invention, the CPU may be a single computing core or may include multiple computing cores.

所述存储器1202,用于存储处理器1201的执行指令,存储器1202可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 1202 is used to store execution instructions of the processor 1201. The memory 1202 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically Erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

当存储器1202中的执行指令由处理器1201执行时,使得电子设备1200能够执行图2或图3或图4所示实施例中的部分或全部步骤。When the execution instructions in the memory 1202 are executed by the processor 1201, the electronic device 1200 is enabled to execute some or all of the steps in the embodiment shown in FIG. 2 or FIG. 3 or FIG. 4.

具体实现中,本发明还提供一种存储介质,其中,该存储介质可存储有程序,该程序执行时可包括本发明提供的文件同步方法的各实施例中的部分或全部步骤。所述的存储介质可为磁碟、光盘、只读存储记忆体(read-only memory,ROM)或随机存储记忆体(randomaccess memory,RAM)等。In specific implementation, the present invention also provides a storage medium, wherein the storage medium can store a program, and when executed, the program can include some or all of the steps in each embodiment of the file synchronization method provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明实施例中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solutions in the embodiments of the present invention can be embodied in the form of software products in essence or those that contribute to the existing technology. The computer software products can be stored in storage media, such as ROM/RAM. , magnetic disk, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.

本说明书中各个实施例之间相同相似的部分互相参见即可。尤其,对于装置实施例和终端实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例中的说明即可。The same and similar parts among the various embodiments in this specification can be referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple. For relevant details, please refer to the description in the method embodiment.

Claims (23)

1. A method of file synchronization, for use with a first device, the method comprising:
acquiring subnet information of equipment to be synchronized and file information to be synchronized;
acquiring record information of a synchronous file, and determining whether subnet information of a second device and file information which is synchronized are present in the record information of the synchronous file according to the subnet information of the device to be synchronized and the file information to be synchronized; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the recording information of the synchronous file is used for recording the subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization;
if yes, a synchronous control instruction is sent to the second equipment; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
2. The method as recited in claim 1, further comprising:
receiving a synchronization completion response message returned by the second equipment;
and updating the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information to be synchronized.
3. The method according to claim 1, further comprising, before the acquiring the subnet information of the device to be synchronized and the file information to be synchronized:
receiving a synchronous file request message sent by the equipment to be synchronized; the synchronous file request message carries subnet information and file information to be synchronized;
sending a synchronous file response message to the equipment to be synchronized;
the acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized comprises the following steps:
and acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized from the synchronous file request message.
4. A method according to claim 3, wherein the synchronization file request message also carries file transfer port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
5. The method of claim 1, further comprising, prior to said sending the synchronization control instruction to the second device:
sending a synchronous file notification message to the equipment to be synchronized;
receiving a synchronous file response message sent by the equipment to be synchronized; and the synchronous file response message carries the file transmission port information of the equipment to be synchronized.
6. The method according to claim 3 or 4, wherein the synchronization control instruction carries file transfer port information of the device to be synchronized.
7. The method of claim 1, wherein the sending a synchronization control instruction to the second device, if any, comprises:
if the information exists, and the subnet information and the file information which are synchronized are the same as the subnet information and the file information to be synchronized of the equipment to be synchronized, the load information of the at least two second equipment is obtained;
and determining a target second device according to the load information of the at least two second devices, and sending a synchronous control instruction to the target second device.
8. The method according to claim 7, wherein the device to be synchronized comprises at least two;
The determining the target second device according to the load information of the at least two second devices comprises:
and determining a target second device corresponding to each device to be synchronized according to the load information of the at least two second devices aiming at each device to be synchronized in the at least two devices to be synchronized.
9. The method of claim 1, wherein the first device is different from a subnet to which the device to be synchronized belongs.
10. The method as recited in claim 1, further comprising:
if the file information to be synchronized does not exist, acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized;
and updating the record information of the synchronous file according to the subnet information of the equipment to be synchronized and the file information to be synchronized.
11. A method of file synchronization, for use with a second device, the method comprising:
receiving a synchronous control instruction; the synchronization control instruction is used for indicating the second equipment to transmit a file to be synchronized to the equipment to be synchronized;
determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction;
and acquiring a file to be synchronized according to the file information to be synchronized, and sending the file to be synchronized to the equipment to be synchronized.
12. The method as recited in claim 11, further comprising:
and sending a synchronization completion response message to the first device.
13. The method of claim 11, wherein the synchronization control instruction carries file transfer port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the equipment to be synchronized performs file transmission;
the sending the file to be synchronized to the device to be synchronized includes:
and sending the file to be synchronized to the equipment to be synchronized through the port indicated by the file transmission port information.
14. A method for synchronizing files, comprising:
receiving a file to be synchronized;
and updating the corresponding file according to the file to be synchronized.
15. The method of claim 14, further comprising, prior to said receiving the file to be synchronized:
sending a synchronous file request message to a first device; the synchronous file request message carries subnet information and file information to be synchronized;
and receiving a synchronous file response message sent by the first equipment.
16. The method according to claim 15, wherein the synchronization file request message further carries file transfer port information of the device to be synchronized; the file transmission port information is used for indicating a port used when the device to be synchronized performs file transmission.
17. The method of claim 14, further comprising, prior to said receiving the file to be synchronized:
receiving a synchronous file notification message sent by the first equipment;
and sending a synchronous file response message to the first device, wherein the synchronous file response message carries the file transmission port information of the device to be synchronized.
18. The method according to claim 16 or 17, wherein receiving the file to be synchronized comprises:
and receiving the file to be synchronized through the port indicated by the file transmission port information.
19. A document synchronization apparatus, comprising:
the acquisition unit is used for acquiring the subnet information of the equipment to be synchronized and the file information to be synchronized;
the processing unit is used for acquiring the record information of the synchronous file, and determining whether the subnet information of the second equipment and the file information which is synchronized exist according to the subnet information of the equipment to be synchronized and the record information of the file information to be synchronized in the synchronous file; the subnet information of the second equipment and the file information which is synchronized are the same as the subnet information of the equipment to be synchronized and the file information to be synchronized; the recording information of the synchronous file is used for recording the subnet information of the equipment which completes the file synchronization and the file information which completes the synchronization;
The processing unit is further configured to send a synchronization control instruction to the second device if the synchronization control instruction exists; the synchronization control instruction is used for indicating the second equipment to transmit the file to be synchronized to the equipment to be synchronized.
20. A document synchronization apparatus, comprising:
the receiving unit is used for receiving the synchronous control instruction; the synchronization control instruction is used for indicating the second equipment to transmit a file to be synchronized to the equipment to be synchronized;
the processing unit is used for determining file information to be synchronized and equipment to be synchronized according to the synchronization control instruction;
the processing unit is further configured to obtain a file to be synchronized according to the file information to be synchronized, and send the file to be synchronized to the device to be synchronized.
21. A document synchronization apparatus, comprising:
the acquisition unit is used for receiving the file to be synchronized;
and the processing unit is used for updating the corresponding file according to the file to be synchronized.
22. An electronic device, comprising: a processor and a memory storing a computer program that, when executed, causes the electronic device to perform the method of any one of claims 1-10 or 11-13 or 14-18.
23. A storage medium comprising a stored program, wherein the program, when run, controls a device in which the storage medium is located to perform the method of any one of claims 1-10 or 11-13 or 14-18.
CN202210605613.2A 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium Active CN117201510B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210605613.2A CN117201510B (en) 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium
PCT/CN2023/095772 WO2023231836A1 (en) 2022-05-30 2023-05-23 File synchronization method, apparatus, device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210605613.2A CN117201510B (en) 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117201510A true CN117201510A (en) 2023-12-08
CN117201510B CN117201510B (en) 2024-11-19

Family

ID=89002162

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210605613.2A Active CN117201510B (en) 2022-05-30 2022-05-30 File synchronization method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN117201510B (en)
WO (1) WO2023231836A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119248737A (en) * 2024-03-29 2025-01-03 荣耀终端有限公司 File synchronization method, electronic device and storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070230434A1 (en) * 2004-05-28 2007-10-04 Jean-Claude Thill Distributed Synchronization Method and System
CN103906087A (en) * 2012-12-28 2014-07-02 华为技术有限公司 Access point upgrading method, device and system
CN103986738A (en) * 2013-02-07 2014-08-13 百度在线网络技术(北京)有限公司 Inter-multi-terminal synchronization method and system
US20140229436A1 (en) * 2013-02-08 2014-08-14 Wistron Corporation Method of File Synchronization and Electronic Device Thereof
CN104008116A (en) * 2013-02-27 2014-08-27 联想(北京)有限公司 File synchronization method and electronic device
CN104244306A (en) * 2014-09-15 2014-12-24 杭州华三通信技术有限公司 Method and device for upgrading access point firmware
US20160157093A1 (en) * 2014-11-28 2016-06-02 Inventec (Pudong) Technology Corporation System and method for updating firmware through hetero-network
CN106060135A (en) * 2016-05-31 2016-10-26 杭州华三通信技术有限公司 Version updating method and device
CN108809468A (en) * 2018-05-25 2018-11-13 东软集团股份有限公司 The method, apparatus and storage medium and electronic equipment of time synchronization
CN109218359A (en) * 2017-07-03 2019-01-15 深圳市中兴微电子技术有限公司 A kind of method and server end of internet of things equipment software upgrading
CN109358876A (en) * 2018-09-28 2019-02-19 联想(北京)有限公司 A kind of version synchronization method and device, equipment, storage medium
CN112118322A (en) * 2020-09-24 2020-12-22 杭州海康威视数字技术股份有限公司 Data synchronization method of network equipment, network equipment and system
CN114489719A (en) * 2021-12-30 2022-05-13 苏州浪潮智能科技有限公司 Software update method, network device and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8959242B1 (en) * 2014-07-02 2015-02-17 Connected Data, Inc. Method of reducing bandwidth required for sharing of files on a server
CN105933393A (en) * 2016-04-12 2016-09-07 乐视控股(北京)有限公司 Intra-local area network data synchronization method, device and user terminal

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070230434A1 (en) * 2004-05-28 2007-10-04 Jean-Claude Thill Distributed Synchronization Method and System
CN103906087A (en) * 2012-12-28 2014-07-02 华为技术有限公司 Access point upgrading method, device and system
CN103986738A (en) * 2013-02-07 2014-08-13 百度在线网络技术(北京)有限公司 Inter-multi-terminal synchronization method and system
US20140229436A1 (en) * 2013-02-08 2014-08-14 Wistron Corporation Method of File Synchronization and Electronic Device Thereof
CN104008116A (en) * 2013-02-27 2014-08-27 联想(北京)有限公司 File synchronization method and electronic device
CN104244306A (en) * 2014-09-15 2014-12-24 杭州华三通信技术有限公司 Method and device for upgrading access point firmware
US20160157093A1 (en) * 2014-11-28 2016-06-02 Inventec (Pudong) Technology Corporation System and method for updating firmware through hetero-network
CN106060135A (en) * 2016-05-31 2016-10-26 杭州华三通信技术有限公司 Version updating method and device
CN109218359A (en) * 2017-07-03 2019-01-15 深圳市中兴微电子技术有限公司 A kind of method and server end of internet of things equipment software upgrading
CN108809468A (en) * 2018-05-25 2018-11-13 东软集团股份有限公司 The method, apparatus and storage medium and electronic equipment of time synchronization
CN109358876A (en) * 2018-09-28 2019-02-19 联想(北京)有限公司 A kind of version synchronization method and device, equipment, storage medium
CN112118322A (en) * 2020-09-24 2020-12-22 杭州海康威视数字技术股份有限公司 Data synchronization method of network equipment, network equipment and system
CN114489719A (en) * 2021-12-30 2022-05-13 苏州浪潮智能科技有限公司 Software update method, network device and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王品德;: "基于DDS的跨域数据同步研究", 通信技术, no. 04, 10 April 2015 (2015-04-10) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119248737A (en) * 2024-03-29 2025-01-03 荣耀终端有限公司 File synchronization method, electronic device and storage medium

Also Published As

Publication number Publication date
WO2023231836A1 (en) 2023-12-07
CN117201510B (en) 2024-11-19

Similar Documents

Publication Publication Date Title
EP3225014B1 (en) Source ip address transparency systems and methods
US11398956B2 (en) Multi-Edge EtherChannel (MEEC) creation and management
CN102238230B (en) Method and system for offloading tunnel packet processing in cloud computing
US10135717B2 (en) Transferring data in a gateway
CN108768817A (en) A virtualized network networking system and data packet sending method
CN111193773B (en) Load balancing method, device, equipment and storage medium
CN113364660B (en) Data packet processing method and device in LVS load balancing
CN112822085B (en) Network deployment method and system
CN115225634B (en) Data forwarding method, device and computer program product under virtual network
US20180205644A1 (en) Communication processing method and apparatus
CN117083843A (en) Discovering hosts using multicast listener discovery
CN115189920A (en) Cross-network domain communication method and related device
CN101631075A (en) Method for processing message and device thereof
EP4181436B1 (en) Data processing method and apparatus, related device and storage medium
CN113839862A (en) Method, system, terminal and storage medium for synchronizing ARP information between MCLAG neighbors
CN120281602B (en) Network intercommunication method, system, electronic device, storage medium and program product
WO2023231836A1 (en) File synchronization method, apparatus, device, and storage medium
CN115941255A (en) A method, device, electronic equipment and storage medium for transferring ARP entry to host routing
KR100431206B1 (en) Table management methode for distributed forwarding in high speed router
JP6162831B2 (en) Packet communication system, SDN control device, packet communication method, and program
CN114826887A (en) Private network connection communication method and system
JP7745795B1 (en) Packet forwarding system and packet forwarding method
CN108965494A (en) Data transmission method and device in data system
CN120342993A (en) Data processing method and device based on address resolution message
CN114793221A (en) NAT (network Address translation) association table processing method and device

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