File synchronization method and system, electronic equipment and storage medium

By using TCP connection to obtain and transmit file synchronization information in a secure isolation gateway environment, the problems of service disabling and file change detection are solved, and the file synchronization is automated, which improves synchronization efficiency and security, and meets the efficient needs of modern offices.

CN119135700APending Publication Date: 2024-12-13VISIONVERA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411043354.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing file synchronization technology has problems with service disabling and file change detection in a secure isolation gateway environment, so it cannot achieve automated file synchronization. The traditional manual transmission method is inefficient and error-prone, and cannot meet the efficient needs of modern offices.

Method used

By obtaining synchronization information of files mounted on the first gateway device, transmitting them to the second gateway device using the Transmission Control Protocol (TCP), and comparing the synchronization information between the two, if different, performing synchronization processing. Implement automated synchronization of files, avoiding dependence on inotify mechanism and disabled FTP/SSH services.

Benefits of technology

It realizes automated file synchronization in a secure isolation gateway environment, improves real-time and accuracy of synchronization, reduces human errors, meets the needs of efficient collaborative work in modern office environments, and improves the security of data transmission through TCP connection transmission. sex.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119135700A_ABST
    Figure CN119135700A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file synchronization method and system. The method comprises the following steps: acquiring first synchronization information of at least one file mounted on first gateway equipment; transmitting the first synchronization information to second gateway equipment through transmission control protocol connection; comparing second synchronization information of at least one file mounted on the second gateway equipment with the first synchronization information; and if the second synchronization information is different from the first synchronization information, carrying out synchronization processing on at least one file mounted on the second gateway equipment. According to the embodiment of the invention, the change of the file can be detected without depending on an inotify mechanism, the real-time synchronization of the file is ensured, the accuracy and efficiency of synchronization are improved, meanwhile, security measures such as encryption are adopted, the security of data transmission is enhanced, and the file synchronization requirement in a high-security environment is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of synchronization technology, and in particular to a file synchronization method, a file synchronization system, an electronic device and a computer-readable storage medium. Background Art

[0002] With the increasing demand for security and confidentiality, many companies and organizations have begun to pay attention to data security issues and use network isolation devices to ensure data security. Network isolation devices completely isolate internal networks from external networks to prevent unauthorized access and data leakage. However, in actual work, cross-regional collaboration is often required between departments of an organization, especially when real-time updates and synchronization of file content are required to achieve collaborative work. This isolation will bring certain challenges. The traditional manual transmission method is not only inefficient, but also prone to errors when processing large amounts of files, and cannot meet the efficiency needs of modern office work.

[0003] Existing file synchronization technologies are usually implemented by deploying file synchronization transfer services on two devices that need to synchronize files, such as inotify (a file system event monitoring mechanism of the Linux kernel) + rsync (a tool for file and directory synchronization), File Transfer Protocol (FTP) or Secure Shell (SSH). These services can monitor changes in the file system and automatically synchronize files to the target device after detecting file modifications. However, these technologies have some limitations and problems in practical applications, especially in scenarios involving high security and confidentiality requirements:

[0004] 1. Service disabling problem: For security and confidentiality requirements, many secure isolation gateways have disabled file synchronization services such as FTP and SSH. This means that traditional file synchronization solutions cannot be deployed and used in these environments, resulting in the inability to achieve automated file synchronization.

[0005] 2. File change detection problem: In traditional file synchronization solutions, file synchronization and transfer services usually rely on the inotify mechanism to detect changes in the file system. However, the security isolation gateway itself does not support the inotify mechanism, resulting in the inability to detect files modified on the host, thus failing to trigger synchronization operations. This further limits the implementation of the file synchronization function. Summary of the invention

[0006] In view of the above problems, embodiments of the present invention are proposed to provide a file synchronization method, a file synchronization system, an electronic device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.

[0007] In order to solve the above problems, an embodiment of the present invention discloses a file synchronization method, which includes: obtaining first synchronization information of at least one file mounted on a first gateway device; transmitting the first synchronization information to a second gateway device via a transmission control protocol connection; comparing second synchronization information of at least one file mounted on the second gateway device with the first synchronization information; if the second synchronization information is different from the first synchronization information, synchronizing at least one file mounted on the second gateway device.

[0008] Optionally, comparing the second synchronization information of at least one file mounted on the second gateway device with the first synchronization information includes: comparing each file name and file information at each position in the second synchronization information with each file name and file information at each position in the first synchronization information in turn.

[0009] Optionally, if the second synchronization information is different from the first synchronization information, synchronization processing is performed on at least one file mounted on the second gateway device, including: if the second synchronization information is different from the first synchronization information, addition processing, deletion processing or update processing is performed on at least one file mounted on the second gateway device.

[0010] Optionally, if the second synchronization information is different from the first synchronization information, at least one file mounted on the second gateway device is added, including: if the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is smaller than the number of the target file name in the second synchronization information, then the file addition request of the second gateway device is sent to the first gateway device; and the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file addition request is added to the file path mounted on the second gateway device.

[0011] Optionally, if the second synchronization information is different from the first synchronization information, at least one file mounted on the second gateway device is deleted, including: if the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is larger than the number of the target file name in the second synchronization information, then the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device is deleted.

[0012] Optionally, if the second synchronization information is different from the first synchronization information, at least one file mounted on the second gateway device is updated, including: if the target file name at the corresponding position in the second synchronization information is the same as that in the first synchronization information, and the target file information of the target file name in the first synchronization information is different from the target file information of the target file name in the second synchronization information, then the file update request of the second gateway device is sent to the first gateway device; and the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file update request is overwritten with the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device.

[0013] Optionally, obtaining the first synchronization information of at least one file mounted on the first gateway device includes: obtaining the first synchronization information according to a preset comparison mode; wherein the comparison mode includes a fast mode and a precise mode; the file information in the first synchronization information and the second synchronization information corresponding to the fast mode includes file size and modification time; the file information in the first synchronization information and the second synchronization information corresponding to the precise mode includes a file verification value.

[0014] An embodiment of the present invention also discloses a file synchronization system, which includes: a first synchronization information acquisition module, used to acquire first synchronization information of at least one file mounted on a first gateway device; a first synchronization information transmission module, used to transmit the first synchronization information to a second gateway device via a transmission control protocol connection; a synchronization information comparison module, used to compare second synchronization information of at least one file mounted on the second gateway device with the first synchronization information; and a mounted file synchronization processing module, used to synchronize at least one file mounted on the second gateway device if the second synchronization information is different from the first synchronization information.

[0015] Optionally, the synchronization information comparison module is used to sequentially compare each file name and file information at each position in the second synchronization information with each file name and file information at each position in the first synchronization information.

[0016] Optionally, the mounted file synchronization processing module is used to add, delete or update at least one file mounted on the second gateway device if the second synchronization information is different from the first synchronization information.

[0017] Optionally, the mounted file synchronization processing module includes: a file adding request sending module, used to send the file adding request of the second gateway device to the first gateway device if the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is smaller than the number of the target file name in the second synchronization information; a file adding module, used to add the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file adding request, to the file path mounted on the second gateway device.

[0018] Optionally, the mounted file synchronization processing module includes: a file deletion module, which is used to mount the file to the second gateway device and delete the target file corresponding to the target file name in the second synchronization information if the target file name in the second synchronization information is different from the target file name at the corresponding position in the first synchronization information, and the number of the target file name in the first synchronization information is larger than the number of the target file name in the second synchronization information.

[0019] Optionally, the mounted file synchronization processing module includes: a file update request sending module, which is used to send the file update request of the second gateway device to the first gateway device if the target file name at the corresponding position in the second synchronization information is the same as that in the first synchronization information, and the target file information of the target file name in the first synchronization information is different from the target file information of the target file name in the second synchronization information; a file update module, which is used to overwrite the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device with the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file update request.

[0020] Optionally, the first synchronization information acquisition module is used to obtain the first synchronization information according to a preset comparison mode; wherein the comparison mode includes a fast mode and a precise mode; the file information in the first synchronization information and the second synchronization information corresponding to the fast mode includes file size and modification time; the file information in the first synchronization information and the second synchronization information corresponding to the precise mode includes a file verification value.

[0021] An embodiment of the present invention further discloses an electronic device, comprising: one or more processors; and one or more machine-readable media storing instructions thereon, which, when executed by the one or more processors, enable the electronic device to execute the file synchronization method as described above.

[0022] The embodiment of the present invention further discloses a computer-readable storage medium, which stores a computer program that enables a processor to execute the file synchronization method as described above.

[0023] The embodiments of the present invention include the following advantages:

[0024] The file synchronization solution provided by the embodiment of the present invention obtains first synchronization information of at least one file mounted on the first gateway device, and then transmits the first synchronization information to the second gateway device through a transmission control protocol connection. Next, the second synchronization information of at least one file mounted on the second gateway device is compared with the first synchronization information. If the second synchronization information is different from the first synchronization information, the at least one file mounted on the second gateway device is synchronized.

[0025] The embodiment of the present invention performs file synchronization through a transmission control protocol (TCP) connection without relying on disabled services such as FTP or SSH, so that automatic file synchronization can be achieved on a secure isolation gateway. This avoids the problem of service disabling and enables file synchronization to be achieved in a high-security environment. Instead of relying on the inotify mechanism, file change detection is achieved by obtaining and comparing the synchronization information of the file. By obtaining the first synchronization information of the file on the first gateway device, transmitting it to the second gateway device, and then comparing it with the second synchronization information, the change of the file can be effectively detected and the synchronization operation can be triggered. This solves the problem of file change detection and realizes automatic synchronization of files. The synchronization information of the file is obtained and compared in an automated manner, ensuring that the file changes can be detected and synchronized in time. Compared with the manual transmission method, the real-time and accuracy of synchronization are improved, the possibility of human errors is reduced, and the demand for efficient collaborative work in a modern office environment is met. By transmitting synchronization information through a TCP connection, security measures (such as encryption) can be adopted during data transmission, thereby improving the security of data transmission. In this way, data can be prevented from being intercepted or tampered with during transmission, meeting the requirements of high security and confidentiality. Synchronization is performed through the connection between the first gateway device and the second gateway device, simplifying the overall management and maintenance work. This reduces the need to configure and maintain synchronization services on each device, improving the maintainability and stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a flowchart of the steps of a file synchronization method according to an embodiment of the present invention;

[0027] Figure 2 It is a schematic diagram of the organizational structure of a file synchronization solution based on a security gateway according to an embodiment of the present invention;

[0028] Figure 3 It is a flowchart of a file synchronization solution based on a security gateway according to an embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of a group of synchronization information comparison in an embodiment of the present invention;

[0030] Figure 5 is another set of synchronization information comparison schematic diagram of an embodiment of the present invention;

[0031] Figure 6 is another set of synchronization information comparison schematic diagrams according to an embodiment of the present invention;

[0032] Figure 7 The present invention is a structural block diagram of a file synchronization system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0034] The file synchronization solution proposed in the embodiment of the present invention realizes automatic synchronization of files on a secure isolation gateway device by utilizing a TCP connection, thereby avoiding the problem of traditional synchronization services such as FTP and SSH being disabled. The specific method is to obtain the first synchronization information of at least one file mounted on the first gateway device, and transmit the first synchronization information to the second gateway device through a TCP connection, and then compare the second synchronization information of at least one file on the second gateway device with the first synchronization information. If it is found that the synchronization information of the two is different, the file on the second gateway device is synchronized. In this way, file changes can be detected without relying on the inotify mechanism, ensuring real-time synchronization of files, improving the accuracy and efficiency of synchronization, and at the same time using security measures such as encryption to enhance the security of data transmission and meet the file synchronization requirements in a high-security environment. In addition, the solution simplifies synchronization management and maintenance work, reduces the configuration and maintenance requirements of synchronization services on each device, and improves the maintainability and stability of the system.

[0035] Reference Figure 1 , shows a flowchart of the steps of a file synchronization method according to an embodiment of the present invention. The file synchronization method may specifically include the following steps:

[0036] Step 101: Acquire first synchronization information of at least one file mounted on a first gateway device.

[0037] In an embodiment of the present invention, it is necessary to ensure that detailed information of the files to be synchronized is accurately obtained for subsequent comparison and synchronization operations. This information usually includes the name, size, modification time, hash value, etc. of the file to uniquely identify the current status of the file. In actual application, the first gateway device scans the file directory mounted by it to find the files to be synchronized. This step can be achieved by traversing the directory structure to ensure that no files are missed. After finding the files to be synchronized, it is necessary to extract the attribute information of these files. The attribute information of the file may include the file name, file size, last modification time, etc. These attribute information can basically reflect the status of the file, but in order to more accurately detect the changes in the file, the hash value of the file can also be calculated. The hash value is a unique file identifier generated by an algorithm. When the file content changes, the hash value will also change accordingly. The extracted file attributes and hash value and other information are combined into a synchronization information package. This information package will be transmitted to the second gateway device as the first synchronization information for comparison.

[0038] For example, suppose there is a file named "report.docx" on the first gateway device. Scan this file and extract its attribute information, such as the file name "report.docx", the file size 1.2MB, and the last modification time of July 25, 2021 at 14:30. Then, calculate the hash value of the file, assuming the hash value is "5d41402abc4b2a76b9719d911017c592". Combine this information into a synchronization information package, namely the first synchronization information.

[0039] Step 102: Transmit the first synchronization information to the second gateway device via a transmission control protocol connection.

[0040] In an embodiment of the present invention, the first gateway device needs to establish a TCP connection with the second gateway device. TCP is a connection-oriented, reliable transport layer protocol that can ensure that data packets are not lost, not repeated, and arrive in order during transmission. The establishment of this connection usually requires specifying the IP address and port number of the second gateway device to ensure that the communicating parties can be correctly interconnected. After the connection is established, the first gateway device needs to package the first synchronization information. The purpose of data packaging is to format the synchronization information according to the requirements of the TCP protocol so that it can be correctly identified and interpreted during the transmission process. After the packaging is completed, the first synchronization information is sent to the second gateway device through the established TCP connection using the first gateway device. During the transmission process, the TCP protocol will segment the data and reassemble it at the receiving end to ensure the integrity and sequence of the data. In addition, the TCP protocol also has flow control and congestion control mechanisms, which can dynamically adjust the data transmission rate according to the network conditions to ensure the stability of the transmission. After receiving the data packet, the second gateway device can send a confirmation message to the first gateway device to confirm that the first synchronization information has been successfully received. This process helps to ensure the reliability of data transmission and triggers a retransmission mechanism when necessary to prevent data loss.

[0041] For example: Assume that the first synchronization information on the first gateway device is the file name "report.docx", the file size is 1.2MB, the last modification time is 14:30 on July 25, 2021, and the hash value is "5d41402abc4b2a76b9719d911017c592". The first gateway device establishes a TCP connection with the second gateway device. The IP address of the second gateway device is 192.168.1.2, and the port number is 8080. After the connection is established, the first gateway device packages this information into a data packet and sends it to the second gateway device via a TCP connection. After receiving the data packet, the second gateway device parses the synchronization information of the file and sends a confirmation message to the first gateway device to confirm that the receipt is successful.

[0042] Step 103: Compare the second synchronization information of at least one file mounted on the second gateway device with the first synchronization information.

[0043] In an embodiment of the present invention, the second gateway device needs to extract the attribute information and hash value of the file corresponding to the first synchronization information from the file directory mounted thereon. This process is similar to the operation on the first gateway device, and the second synchronization information is generated by scanning the file directory, extracting the file attributes and calculating the hash value. After obtaining the second synchronization information, it is necessary to compare it with the first synchronization information in detail. The contents of the comparison include the file name, file size, last modification time, and hash value, etc. If there is a difference in any aspect between the two sets of information, it means that the files are out of sync between the two devices. The comparison results need to be recorded for subsequent synchronization processing. If the files are exactly the same, no further operation is required; if the files are different, the synchronization mechanism needs to be triggered to ensure that the file content is consistent between the two devices.

[0044] For example: Assume that there is a file named "report.docx" on the second gateway device. Extract the attribute information of the file, such as the file name "report.docx", file size 1.2MB, and last modification time of July 25, 2021 at 14:35, and calculate its hash value as "5d41402abc4b2a76b9719d911017c592". Then, compare this information with the first synchronization information received from the first gateway device (file name "report.docx", file size 1.2MB, last modification time of July 25, 2021 at 14:30, hash value "5d41402abc4b2a76b9719d911017c592"). Through comparison, it is found that although the file name, file size and hash value are the same, the last modification time is different, indicating that there are differences between the files on the two devices and further synchronization processing is required.

[0045] Step 104: If the second synchronization information is different from the first synchronization information, synchronization processing is performed on at least one file mounted on the second gateway device.

[0046] In an embodiment of the present invention, after the second synchronization information is detected to be different from the first synchronization information in the previous step, the file mounted on the second gateway device needs to be synchronized. According to the comparison result, the direction and mode of synchronization are determined. If the file on the first gateway device is newer, its content is synchronized to the second gateway device; if the file on the second gateway device is newer, its content is synchronized to the first gateway device. In addition, it is also necessary to consider whether bidirectional synchronization is required to ensure that the file content on the two devices is consistent. According to the determined synchronization method, the specific content of the file is transmitted through a TCP connection. If the file content on the first gateway device needs to be synchronized to the second gateway device, the first gateway device packages the file content and sends it to the second gateway device through a TCP connection. During the transmission process, the integrity and security of the data need to be ensured, and encryption technology can be used to protect the transmitted data. After the second gateway device receives the file content, it needs to unpack it and update it to the local file directory. This process needs to pay attention to the overwriting and backup of the file to prevent data loss or erroneous overwriting. After the file update is completed, the second gateway device needs to send a confirmation message to the first gateway device to confirm that the synchronization operation has been successfully completed. This confirmation message helps the first gateway device record the synchronization status and trigger subsequent operations when necessary.

[0047] For example: Assume that the "report.docx" file on the first gateway device is newer and needs to be synchronized to the second gateway device. After comparing and discovering the file differences, the first gateway device decides to synchronize its file content to the second gateway device. The first gateway device packages the "report.docx" file content and transmits it to the second gateway device through a TCP connection. During the transmission process, the file content is encrypted to ensure data security. After receiving the file content, the second gateway device unpacks and overwrites the local "report.docx" file, and backs it up to prevent data loss. After the file update is completed, the second gateway device sends a confirmation message to the first gateway device to confirm that the synchronization operation has been successfully completed.

[0048] The file synchronization solution provided by the embodiment of the present invention obtains first synchronization information of at least one file mounted on the first gateway device, and then transmits the first synchronization information to the second gateway device through a transmission control protocol connection. Next, the second synchronization information of at least one file mounted on the second gateway device is compared with the first synchronization information. If the second synchronization information is different from the first synchronization information, the at least one file mounted on the second gateway device is synchronized.

[0049] The embodiment of the present invention performs file synchronization through a transmission control protocol (TCP) connection without relying on disabled services such as FTP or SSH, so that automatic file synchronization can be achieved on a secure isolation gateway. This avoids the problem of service disabling and enables file synchronization to be achieved in a high-security environment. Instead of relying on the inotify mechanism, file change detection is achieved by obtaining and comparing the synchronization information of the file. By obtaining the first synchronization information of the file on the first gateway device, transmitting it to the second gateway device, and then comparing it with the second synchronization information, the change of the file can be effectively detected and the synchronization operation can be triggered. This solves the problem of file change detection and realizes automatic synchronization of files. The synchronization information of the file is obtained and compared in an automated manner, ensuring that the file changes can be detected and synchronized in time. Compared with the manual transmission method, the real-time and accuracy of synchronization are improved, the possibility of human errors is reduced, and the demand for efficient collaborative work in a modern office environment is met. By transmitting synchronization information through a TCP connection, security measures (such as encryption) can be adopted during data transmission, thereby improving the security of data transmission. In this way, data can be prevented from being intercepted or tampered with during transmission, meeting the requirements of high security and confidentiality. Synchronization is performed through the connection between the first gateway device and the second gateway device, simplifying the overall management and maintenance work. This reduces the need to configure and maintain synchronization services on each device, improving the maintainability and stability of the system.

[0050] In an exemplary embodiment of the present invention, one implementation method of comparing the second synchronization information of at least one file mounted on the second gateway device with the first synchronization information is to compare each file name and file information at each position in the second synchronization information with each file name and file information at each position in the first synchronization information in turn. In the actual application process, the first synchronization information on the first gateway device and the second synchronization information on the second gateway device have been obtained. These synchronization information include detailed information such as the name, size, modification time, hash value, etc. of the file. Each file in the second synchronization information is traversed in turn, and the file names are first compared. By comparing the file names, it can be determined whether there are files with the same name on the two devices. If the file names are the same, the file information is continued to be compared; if the file names are different, the file is recorded as an unsynchronized file. For files with the same file name, the file information is further compared, including the file size, the last modification time, the hash value, etc. This information can accurately reflect the current status of the file. If any of the information is different, it is determined that there is a difference between the files on the two devices. The comparison results are recorded, including the file name and the specific information of the difference. These records will be used for subsequent synchronization processing to ensure that the difference files can be accurately synchronized.

[0051] For example: Assume that the following files exist on the first gateway device and the second gateway device respectively:

[0052] First gateway device (first synchronization information):

[0053] File name: report.docx, size: 1.2MB, last modified: 2021-07-25 14:30, hash value: 5d41402abc4b2a76b9719d911017c592

[0054] File name: summary.pdf, size: 500KB, last modified: 2021-07-25 14:00, hash value: 6d41402abc4b2a76b9719d911017c593

[0055] Second gateway device (second synchronization information):

[0056] File name: report.docx, size: 1.2MB, last modified: 2021-07-25 14:35, hash value: 5d41402abc4b2a76b9719d911017c592

[0057] File name: summary.pdf, size: 500KB, last modified: 2021-07-25 14:00, hash value: 6d41402abc4b2a76b9719d911017c593

[0058] File name: notes.txt, size: 200KB, last modified: 2024-07-25 13:00, hash value: 7d41402abc4b2a76b9719d911017c594

[0059] The comparison process is as follows:

[0060] 1. Traverse the first file "report.docx" in the second synchronization information, compare the file name with the file name in the first synchronization information, and find that the file names are the same.

[0061] 2. Continue to compare the file information of "report.docx" and find that the file size and hash value are the same, but the last modification time is different. Record the file as an unsynchronized file.

[0062] 3. Traverse the second file "summary.pdf" in the second synchronization information, compare the file name with the file name in the first synchronization information, and find that the file names are the same.

[0063] 4. Compare the file information of "summary.pdf" and find that all the information is the same, so record the file as a synchronized file.

[0064] 5. Traverse the third file "notes.txt" in the second synchronization information, and do not find a file with the same name in the first synchronization information, so the file is recorded as an unsynchronized file.

[0065] The embodiment of the present invention can accurately detect the file differences between two gateway devices by comparing the file names and file information one by one, thereby ensuring the accuracy and completeness of the synchronization process. During the comparison process, only the files with differences need to be processed, which reduces unnecessary file transfers and improves synchronization efficiency. After recording the comparison results, synchronization processing can be performed based on the specific difference files, simplifying the overall synchronization management process. By comparing file information in detail, the consistency of file content is ensured, and potential problems caused by data inconsistency are avoided.

[0066] In an exemplary embodiment of the present invention, if the second synchronization information is different from the first synchronization information, an implementation method of performing synchronization processing on at least one file mounted on the second gateway device is that if the second synchronization information is different from the first synchronization information, at least one file mounted on the second gateway device is added, deleted or updated. The process of obtaining the first synchronization information and the second synchronization information and comparing the two to determine the file difference has been described in detail above. In this step, the difference information will be used to guide the subsequent synchronization processing. For files that exist in the first synchronization information but not in the second synchronization information, addition processing is required. That is, these files are transferred from the first gateway device to the second gateway device to ensure that these files also exist on the second gateway device. For files that exist in the second synchronization information but not in the first synchronization information, deletion processing is required. This is to ensure that there are no redundant or expired files on the second gateway device and maintain consistency with the first gateway device. For files with the same file name but different file information, update processing is required. This includes transferring the latest file content on the first gateway device to the second gateway device, overwriting the old version file, to ensure the consistency of the file content.

[0067] For example: Assume that the first gateway device and the second gateway device have the following files:

[0068] First gateway device (first synchronization information):

[0069] File name: report.docx, Size: 1.2MB, Last modified: 2024-07-25 14:30, Hash value: 5d41402abc4b2a76b9719d911017c592

[0070] File name: summary.pdf, size: 500KB, last modified: 2024-07-25 14:00, hash value: 6d41402abc4b2a76b9719d911017c593

[0071] Second gateway device (second synchronization information)**:

[0072] File name: report.docx, Size: 1.2MB, Last modified: 2024-07-25 14:35, Hash value: 5d41402abc4b2a76b9719d911017c592

[0073] File name: summary.pdf, size: 500KB, last modified: 2024-07-25 14:00, hash value: 6d41402abc4b2a76b9719d911017c593

[0074] File name: notes.txt, size: 200KB, last modified: 2024-07-25 13:00, hash value: 7d41402abc4b2a76b9719d911017c594

[0075] The comparison results are as follows:

[0076] 1. Add processing:

[0077] Files that exist in the first sync information but not in the second sync information: None

[0078] Since there is no such file, no additional processing is required.

[0079] 2. Deletion processing:

[0080] File that exists in the second synchronization information but not in the first synchronization information: notes.txt

[0081] The "notes.txt" file needs to be deleted from the second gateway device to ensure that it is consistent with the first gateway device.

[0082] 3. Update processing:

[0083] Files with the same file name but different file information: report.docx

[0084] Since the last modification time of "report.docx" is different, although the hash value is the same, it needs to be updated to ensure that the time information of the file is consistent. The "report.docx" file on the first gateway device is transferred to the second gateway device, overwriting the old file.

[0085] The embodiments of the present invention can ensure that the files on the two gateway devices remain consistent through addition, deletion and update processing, effectively preventing problems caused by inconsistent file content. The automated synchronization processing method reduces manual intervention and improves the simplicity and efficiency of operation. The deletion process can clear unnecessary files on the second gateway device, reduce the waste of storage space and data redundancy. Through timely update processing, it is ensured that the file content on the second gateway device is always up to date to meet the needs of real-time collaboration. Through detailed comparison of file information, it is ensured that each synchronization operation can be carried out accurately, thereby improving the security and reliability of data transmission.

[0086] In an exemplary embodiment of the present invention, if the second synchronization information is different from the first synchronization information, an implementation method of adding processing to at least one file mounted on the second gateway device is that if the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is smaller than the number of the target file name in the second synchronization information, then the second gateway device sends a request to add a file to the first gateway device; the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the request to add a file is added to the file path mounted on the second gateway device. In the previous steps, the first synchronization information on the first gateway device and the second synchronization information on the second gateway device have been obtained. These synchronization information include file names and their related numbers. The first step of implementing the addition process is to compare the numbers of the target file names on the two devices. The number is usually a part of the file name, which is used to distinguish the version or order of the file. For example, the target file name can contain a date or version number, such as "report_v1.docx" and "report_v2.docx". If a target file name in the second synchronization information is different from the corresponding target file name in the first synchronization information, and the number of the target file name in the first synchronization information is smaller than the number of the target file name in the second synchronization information, it indicates that the new version file existing on the first gateway device is missing on the second gateway device. In this case, the target file needs to be transferred from the first gateway device to the second gateway device. According to the comparison result, the second gateway device will initiate a request to add a file. The request contains the target file name and other related information to be synchronized, such as the file path, number, etc. This request will be sent to the first gateway device to notify it that the corresponding file needs to be transferred. After receiving the request to add a file, the first gateway device will search and extract the corresponding target file according to the information in the request. For example, "report_v2.docx" is found from the storage of the first gateway device and is ready to be transferred. After that, the first gateway device transfers the target file to the specified path of the second gateway device. The transmission process may include data encryption and integrity verification to ensure that the file is not tampered with or lost during the transmission process. Once the file transfer is completed, the second gateway device will add a new file to its mounted file path. For example, the "report_v2.docx" file is placed under the original file path to make it a valid file on the second gateway device.

[0087] For example: Assume that the first gateway device and the second gateway device have the following files:

[0088] First gateway device (first synchronization information):

[0089] File name: report_v1.docx, number: 1

[0090] File name: report_v2.docx, number: 2

[0091] Second gateway device (second synchronization information):

[0092] File name: report_v1.docx, number: 1

[0093] During the comparison process, it is found that the second gateway device lacks the "report_v2.docx" file, while the first gateway device has the file with a higher number. At this time, the second gateway device initiates a request to add a file, requesting the first gateway device to send "report_v2.docx". After the first gateway device processes the request, it transmits "report_v2.docx" to the second gateway device and stores it in the correct file path.

[0094] The embodiment of the present invention ensures that the second gateway device has a complete set of files by transferring the latest version of the target file from the first gateway device to the second gateway device, thereby avoiding data inconsistency caused by missing files. The automated increase processing method reduces manual intervention and improves the efficiency and accuracy of the operation. By comparing the file numbers, the file versions can be effectively managed to ensure that the latest version of the file is updated in a timely manner.

[0095] In an exemplary embodiment of the present invention, if the second synchronization information is different from the first synchronization information, an implementation method of deleting at least one file mounted on the second gateway device is that if the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is greater than the number of the target file name in the second synchronization information, the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device is deleted. In the previous steps, the synchronization information of the first gateway device and the second gateway device has been obtained, and the files have been compared. The first step of the deletion process is to compare the file names and numbers of the target files in the two devices. The number in the target file name is usually used to identify the version or order of the file. For example, the target file name may contain a date or version number, such as "report_v2.docx" and "report_v3.docx". If it is found that the target file name in the second synchronization information is different from the target file name in the first synchronization information, and the target file name number in the first synchronization information is greater than the number in the second synchronization information, it means that the file on the second gateway device is an old version or an unnecessary file. In this case, these files need to be deleted from the second gateway device. According to the above comparison results, the actual deletion operation is performed. This process may include marking of files, deletion confirmation, and actual file removal.

[0096] For example: Assume that the file information on the first gateway device and the second gateway device is as follows:

[0097] First gateway device (first synchronization information):

[0098] File name: report.docx, number: 1

[0099] Second gateway device (second synchronization information):

[0100] File name: report.docx, number: 1

[0101] File name: summary.docx, number: 2

[0102] The comparison process is as follows:

[0103] Comparing the file name and number of "report.docx", it is found that they are the same. Next, the first gateway device lacks "summary.docx" on the second gateway device. The second gateway device performs a deletion operation and deletes "summary.docx" from the file path.

[0104] The embodiment of the present invention can effectively clean up unnecessary data and save storage space by deleting old versions or unnecessary files. It ensures that the files on the second gateway device are consistent with those on the first gateway device, avoiding data inconsistency problems caused by version differences. It reduces the system storage burden and improves file management efficiency. Deleting unnecessary files can make the file system run more smoothly. Automated deletion processing reduces manual intervention, simplifies the file management process, and improves work efficiency.

[0105] In an exemplary embodiment of the present invention, if the second synchronization information is different from the first synchronization information, an implementation method of updating at least one file mounted on the second gateway device is that if the target file name at the corresponding position in the second synchronization information is the same as that in the first synchronization information, and the target file information of the target file name in the first synchronization information is different from the target file information of the target file name in the second synchronization information, then the update file request of the second gateway device is sent to the first gateway device; the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the update file request is overwritten with the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device. In the previous steps, the first synchronization information on the first gateway device and the second synchronization information on the second gateway device have been obtained. These synchronization information include detailed information of the file name and the file, such as file size, modification time and hash value. The comparison of file information includes checking the content, size, last modification time and the like of the file. If it is found that the file name is the same but the file information is different, it means that the file content has changed and needs to be updated. Once it is determined that the file needs to be updated, the second gateway device will generate an update file request. This request includes the specific difference between the file name and the file information to be updated, and usually also includes information such as the path and version number of the file. The second gateway device sends the generated update file request to the first gateway device through the network. The request describes in detail the file information that needs to be updated so that the first gateway device can accurately identify and process the request. After the request is sent, the first gateway device will receive the update file request and prepare to process it accordingly. After the first gateway device receives the update file request, it finds the file that needs to be updated based on the information in the request. Next, the first gateway device transfers the latest version of the file to the second gateway device, overwriting the corresponding old file on the second gateway device. The transmission process may include data encryption and integrity verification to ensure that the file is not tampered with or lost during the transmission process. After the file transfer is completed, the second gateway device will overwrite the existing old file with the received file.

[0106] For example: Assume that the file information on the first gateway device and the second gateway device is as follows:

[0107] First gateway device (first synchronization information):

[0108] File name: report_v2.docx, File size: 1.2MB, Last modified: 2021-07-26 10:00, Hash value: 5d41402abc4b2a76b9719d911017c593

[0109] Second gateway device (second synchronization information):

[0110] File name: report_v2.docx, File size: 1.1MB, Last modified: 2021-07-25 15:00, Hash value: 5d41402abc4b2a76b9719d911017c594

[0111] The comparison results are as follows:

[0112] It is found that the "report_v2.docx" file on the second gateway device is different from the same file on the first gateway device in file size and hash value, indicating that the file content has changed. The second gateway device generates an update request, indicating that "report_v2.docx" needs to be updated from the first gateway device, along with the file path and version number information. A request is sent to the first gateway device, requesting the latest "report_v2.docx" file. After receiving the request, the first gateway device extracts the latest "report_v2.docx" file from the storage and transmits it to the second gateway device. The second gateway device overwrites the old version with the latest "report_v2.docx" file received and updates the file system status.

[0113] The embodiment of the present invention can ensure that the file on the second gateway device is consistent with the file content on the first gateway device through update processing, avoiding data errors or collaboration problems caused by version mismatch. Automated update operations ensure the integrity and accuracy of files and reduce the possibility of errors in manual operations. Automated file update processing reduces manual intervention, improves the overall efficiency of file synchronization, and enables file content to be updated in real time. By comparing file information, file versions can be effectively managed to ensure that the latest version of the file can be updated in a timely manner on all relevant devices.

[0114] In an exemplary embodiment of the present invention, an implementation method for obtaining the first synchronization information of at least one file mounted on the first gateway device is to obtain the first synchronization information according to a preset comparison mode; wherein the comparison mode includes a fast mode and a precise mode; the file information in the first synchronization information and the second synchronization information corresponding to the fast mode includes the file size and modification time; the file information in the first synchronization information and the second synchronization information corresponding to the precise mode includes a file checksum value. During the file synchronization process, in order to ensure the accuracy and efficiency of the synchronization operation, it is necessary to obtain the file synchronization information on the first gateway device and the second gateway device. In order to meet different needs, this implementation method introduces two comparison modes: a fast mode and a precise mode. These two comparison modes provide different levels of information so that the appropriate comparison method can be selected in different situations. Before obtaining the first synchronization information and the second synchronization information, it is necessary to determine which comparison mode to use. This selection is determined based on the accuracy requirements of the synchronization and the limitations of system resources. The comparison modes are divided into a fast mode and a precise mode:

[0115] Fast mode: Suitable for scenarios that require fast processing, focusing on basic file attributes such as file size and modification time.

[0116] Precise mode: Applicable to scenarios that require high-precision comparison, focusing on the integrity and accuracy of files, and comparing through file verification values ​​(such as hash values).

[0117] In the fast mode, the first synchronization information and the second synchronization information obtained mainly include the size and last modification time of the file. This information can quickly provide the basic changes of the file. The fast mode is usually used in scenarios where there are a large number of files but the comparison accuracy requirement is not high. The changes in the file size and modification time can quickly reflect whether the file has been updated.

[0118] In the precise mode, the first synchronization information and the second synchronization information obtained include the checksum value (such as hash value) of the file. These checksum values ​​can ensure that the content of the file has not changed, thereby providing higher comparison accuracy. The precise mode is suitable for scenarios with extremely high requirements for file consistency, such as when the file content is very important and cannot have any errors.

[0119] For example: Assume that the file synchronization information on the first gateway device and the second gateway device is as follows:

[0120] First gateway device (obtaining first synchronization information):

[0121] Quick mode: File name: document_v1.pdf. File size: 2.5MB. Modification time: 2021-07-26 15:00.

[0122] Precise mode: File name: document_v1.pdf. File size: 2.5MB. Modification time: 2021-07-26 15:00. Checksum: "9e107d9d372bb6826bd81d3542e6f0c9".

[0123] Second gateway device (obtaining second synchronization information):

[0124] Quick mode: File name: document_v1.pdf. File size: 2.5MB. Modification time: 2021-07-26 15:00.

[0125] Precise mode: File name: document_v1.pdf. File size: 2.5MB. Modification time: 2021-07-26 15:00. Checksum: "9e107d9d372bb6826bd81d3542e6f0c9".

[0126] The fast mode in the embodiment of the present invention can use fewer resources to perform basic synchronization comparison when a quick response is required, and is suitable for situations with a large number of files. The precise mode provides high-precision synchronization verification by comparing the check values, ensuring that the content of the file has not changed, and is suitable for scenarios with high requirements for data integrity. Two comparison modes are provided, and the appropriate mode can be selected according to specific needs, making the file synchronization operation more flexible and efficient. According to the selection of different comparison modes, system resources can be effectively utilized to improve the overall efficiency and accuracy of file synchronization.

[0127] Based on the above description of a file synchronization method embodiment, a file synchronization solution based on a security gateway is introduced below. Figure 2 , shows a schematic diagram of the organizational structure of a file synchronization solution based on a security gateway according to an embodiment of the present invention. The file synchronization solution based on a security gateway involves region A and region B. Region A and region B respectively include respective computer hosts, security gateways, and gateway services. The respective security gateways of region A and region B are interconnected. In region A and region B, the computer hosts and gateway services are respectively connected to the security gateways.

[0128] The security gateway in area A serves as the source device for synchronizing files, and the security gateway in area B serves as the destination device for synchronizing files. The gateway services of area A and area B configure the IP and file directory of the computer hosts in their respective areas on the security gateways, and mount the file directories of the computer hosts in their respective areas to the security gateways. The gateway service of area A configures the synchronization task, sets the source file directory path, the destination security gateway IP, the destination security gateway file directory path, the synchronization method, the monitoring interval and other information. Based on the synchronization task, the security gateway of area A connects to the IP of the security gateway of area B and sends the synchronization method, file directory and other information. The security gateway of area A sends the file information of the source file directory path to the security gateway of area B according to the monitoring interval. The security gateway of area B receives the file information, compares it with the local file information, and then synchronizes the local files.

[0129] Reference Figure 3 , shows a flow chart of a file synchronization solution based on a security gateway according to an embodiment of the present invention.

[0130] The file synchronization solution based on the security gateway can be mainly divided into three parts: creating synchronization tasks, file information comparison, and file synchronization.

[0131] Create a synchronization task:

[0132] Configure the computer host IP and file directory path that need to be synchronized in the web interface of the security gateway in area A (source gateway) and the security gateway in area B (destination gateway).

[0133] The source gateway and the destination gateway use the samba command to mount the host's directory path to their respective gateways based on the configured host IP and directory path.

[0134] Create a synchronization task on the web interface of the source gateway, fill in the local source file directory path to be synchronized, the IP address of the destination gateway, the file directory path of the destination gateway, the file detection method, the file detection interval, and save the synchronization task information to the source gateway database.

[0135] The file synchronization program of the source gateway detects the database content and obtains the synchronization task information.

[0136] The source gateway establishes a TCP connection with the destination gateway IP in the synchronization task information and sends the synchronization task information to the destination gateway.

[0137] File information comparison:

[0138] For the destination gateway, according to the destination file directory path that needs to be synchronized, traverse all files in the directory. If it is in fast mode, obtain the file size and last modification time; if it is in precise mode, obtain the MD5 message digest algorithm (MD5 Message-Digest Algorithm) value of the file, and arrange all file information in order from small to large file names to obtain the second synchronization information.

[0139] For the source gateway, according to the source file directory path that needs to be synchronized, traverse all files in the directory. If it is in fast mode, obtain the file size and last modification time; if it is in precise mode, obtain the MD5 value of the file, and arrange all file information in ascending order according to the file name to obtain the first synchronization information.

[0140] The source gateway sends the file information to the destination gateway through a TCP connection. After receiving the file information, the destination gateway compares it with the local file information, determines whether the file needs to be synchronized according to the comparison rules, and initiates a synchronization request based on the comparison result.

[0141] File Sync:

[0142] If the destination gateway needs to synchronize files, it sends a synchronization request to the source gateway through a TCP connection to inform the source gateway of the files that need to be synchronized.

[0143] The source gateway receives the synchronization request and sends the file content to the destination gateway through a TCP connection. The file content is sent in packets, and each packet contains the total number of file packets and the current packet sequence number.

[0144] The destination gateway creates a hidden temporary file and receives the file content sent by the source gateway.

[0145] After the file is sent, the source gateway sends a transmission end instruction to the destination gateway. The destination gateway determines whether the file is received completely according to the data packet sequence number. If it is not received completely, it will request the source gateway to send the missing packet again. After the file is received completely, it will determine whether the file is occupied and then replace the old file.

[0146] After receiving the file, the destination gateway updates the local file information record.

[0147] The specific file synchronization process can be roughly divided into three situations: adding files, deleting files, and updating files.

[0148] Traverse the files under the file directory path, obtain all file information, and sort the file information of these files in ascending order of file name. Assuming that the files of the source gateway need to be synchronized to the destination gateway, the source gateway sends the sorted synchronization information to the destination gateway according to the configured synchronization task information. The destination gateway compares it with the locally sorted synchronization information and determines whether the file needs to be synchronized.

[0149] Add files:

[0150] Reference Figure 4 , showing a set of synchronization information comparison schematic diagrams of an embodiment of the present invention. First, the first file of the source gateway and the destination gateway are compared. The file name (file a) and the file information (file a information) are consistent. Then, the second file of the source gateway and the destination gateway are compared. It is determined that the file names are different and the second file name (file b) of the source gateway is smaller than the second file name (file c) of the destination gateway. It is determined that the file b of the source gateway does not exist in the destination gateway. The destination gateway needs to add file b. At this time, the destination gateway requests the source gateway to transfer file b. Then the file position of the destination gateway is increased by 1, and the file position of the source gateway remains unchanged. Next, the third file (file c) of the source gateway is compared with the second file (file c) of the destination gateway, and so on, including comparison of file d and file d information, etc.

[0151] To delete a file:

[0152] Reference Figure 5 , showing another set of synchronization information comparison schematic diagrams of an embodiment of the present invention. First, the first file of the source gateway and the destination gateway are compared. The file name (file a) and the file information (file a information) are consistent. Then, the second file of the source gateway and the destination gateway are compared. It is determined that the file names are different and the second file name (file c) of the source gateway is larger than the second file name (file b) of the destination gateway. It is determined that file b of the destination gateway does not exist in the source gateway. The destination gateway needs to delete file b. At this time, the destination gateway directly deletes file b. The file position of the destination gateway is reduced by 1, and the file position of the source gateway remains unchanged. Next, the second file (file c) of the source gateway and the third file (file c) of the destination gateway are compared, and so on, including comparison of file d and file d information, etc.

[0153] Updated files:

[0154] Reference Figure 6 , showing another set of synchronization information comparison schematic diagrams of an embodiment of the present invention. First, the first file of the source gateway and the destination gateway are compared. The file name (file a) and the file information (file a information) are consistent. Then, the second file of the source gateway and the destination gateway are compared. It is determined that the file names are the same but the file information (file b information) of the second file of the source gateway is inconsistent with the file information (file b information) of the second file of the destination gateway. It is determined that the destination gateway needs to update file b. At this time, the destination gateway requests the source gateway to transfer file b. The file positions of the destination gateway and the source gateway are both increased by 1. Next, the third file (file c) of the source gateway and the third file (file c) of the destination gateway are compared, and so on, including comparing file d and file d information, etc.

[0155] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0156] Reference Figure 7 , shows a structural block diagram of a file synchronization system according to an embodiment of the present invention. The file synchronization system may specifically include the following modules.

[0157] A first synchronization information acquisition module 71, used to acquire first synchronization information of at least one file mounted on the first gateway device;

[0158] A first synchronization information transmission module 72, used to transmit the first synchronization information to the second gateway device via a transmission control protocol connection;

[0159] A synchronization information comparison module 73, configured to compare second synchronization information of at least one file mounted on the second gateway device with the first synchronization information;

[0160] The mounted file synchronization processing module 74 is used to synchronize at least one file mounted on the second gateway device if the second synchronization information is different from the first synchronization information.

[0161] In an exemplary embodiment of the present invention, the synchronization information comparison module 73 is used to sequentially compare each file name and file information at each position in the second synchronization information with each file name and file information at each position in the first synchronization information.

[0162] In an exemplary embodiment of the present invention, the mounted file synchronization processing module 74 is used to add, delete or update at least one file mounted on the second gateway device if the second synchronization information is different from the first synchronization information.

[0163] In an exemplary embodiment of the present invention, the mounted file synchronization processing module 74 includes:

[0164] a file adding request sending module, configured to send the file adding request of the second gateway device to the first gateway device if the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is smaller than the number of the target file name in the second synchronization information;

[0165] The file adding module is used to add the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file adding request to the file path mounted on the second gateway device.

[0166] In an exemplary embodiment of the present invention, the mounted file synchronization processing module 74 includes:

[0167] A file deletion module is used to mount the target file corresponding to the target file name in the second synchronization information to the second gateway device if the target file name in the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is greater than the number of the target file name in the second synchronization information. The target file is deleted.

[0168] In an exemplary embodiment of the present invention, the mounted file synchronization processing module 74 includes:

[0169] a file update request sending module, configured to send a file update request of the second gateway device to the first gateway device if the target file name at the corresponding position in the second synchronization information is the same as that in the first synchronization information, and the target file information of the target file name in the first synchronization information is different from the target file information of the target file name in the second synchronization information;

[0170] The file update module is used to overwrite the target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file update request with the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device.

[0171] In an exemplary embodiment of the present invention, the first synchronization information acquisition module 71 is used to acquire the first synchronization information according to a preset comparison mode;

[0172] Wherein, the comparison mode includes a fast mode and a precise mode;

[0173] The file information in the first synchronization information and the second synchronization information corresponding to the quick mode includes file size and modification time;

[0174] The file information in the first synchronization information and the second synchronization information corresponding to the precise mode includes a file check value.

[0175] As for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0176] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0177] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0178] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0179] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0180] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0181] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0182] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0183] The above is a detailed introduction to a file synchronization method and a file synchronization system provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A file synchronization method, characterized in that: The method comprises: Acquire first synchronization information of at least one file mounted on the first gateway device; Transmitting the first synchronization information to a second gateway device via a transmission control protocol connection; comparing second synchronization information of at least one file mounted on the second gateway device with the first synchronization information; If the second synchronization information is different from the first synchronization information, synchronization processing is performed on at least one file mounted on the second gateway device.

2. The method according to claim 1, characterized in that The comparing the second synchronization information of at least one file mounted on the second gateway device with the first synchronization information includes: Each file name and file information at each position in the second synchronization information is compared in sequence with each file name and file information at each position in the first synchronization information.

3. The method according to claim 1, characterized in that If the second synchronization information is different from the first synchronization information, synchronizing at least one file mounted on the second gateway device, including: If the second synchronization information is different from the first synchronization information, at least one file mounted on the second gateway device is added, deleted or updated.

4. The method according to claim 3, characterized in that If the second synchronization information is different from the first synchronization information, adding processing to at least one file mounted on the second gateway device includes: If the target file name at the corresponding position in the second synchronization information is different from that in the first synchronization information, and the number of the target file name in the first synchronization information is smaller than the number of the target file name in the second synchronization information, sending the file adding request of the second gateway device to the first gateway device; The target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file adding request is added to the file path mounted on the second gateway device.

5. The method according to claim 3, characterized in that: If the second synchronization information is different from the first synchronization information, deleting at least one file mounted on the second gateway device includes: If the target file name in the second synchronization information is different from the target file name at the corresponding position in the first synchronization information, and the number of the target file name in the first synchronization information is larger than the number of the target file name in the second synchronization information, it will be mounted to the second gateway device, and the target file corresponding to the target file name in the second synchronization information will be deleted.

6. The method according to claim 3, characterized in that If the second synchronization information is different from the first synchronization information, updating at least one file mounted on the second gateway device includes: If the target file name at the corresponding position in the second synchronization information is the same as that in the first synchronization information, and the target file information of the target file name in the first synchronization information is different from the target file information of the target file name in the second synchronization information, then sending the file update request of the second gateway device to the first gateway device; The target file corresponding to the target file name in the first synchronization information sent by the first gateway device according to the file update request is used to overwrite the target file corresponding to the target file name in the second synchronization information mounted on the second gateway device.

7. The method according to claim 2, characterized in that The obtaining first synchronization information of at least one file mounted on the first gateway device includes: Acquire the first synchronization information according to a preset comparison mode; Wherein, the comparison mode includes a fast mode and a precise mode; The file information in the first synchronization information and the second synchronization information corresponding to the quick mode includes file size and modification time; The file information in the first synchronization information and the second synchronization information corresponding to the precise mode includes a file check value.

8. A file synchronization system, characterized in that: The system comprises: A first synchronization information acquisition module, used to acquire first synchronization information of at least one file mounted on the first gateway device; A first synchronization information transmission module, used for transmitting the first synchronization information to the second gateway device via a transmission control protocol connection; a synchronization information comparison module, configured to compare second synchronization information of at least one file mounted on the second gateway device with the first synchronization information; The mounted file synchronization processing module is used to synchronize at least one file mounted on the second gateway device if the second synchronization information is different from the first synchronization information.

9. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to execute the file synchronization method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer program stored therein enables the processor to execute the file synchronization method as claimed in any one of claims 1 to 7.