Cross-LAN data synchronization method, device, equipment and storage medium
By setting up a transit device on the sending end and using http and json protocols for data loop transmission, the problem of low data integrity and stability in cross-local network data synchronization is solved, and more efficient and reliable data synchronization is achieved.
Patent Information
- Application Number
- CN202110644238.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-09
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-06-09
AI Technical Summary
The data synchronization scheme between cross-local area networks in the prior art has relatively low integrity and stability in transmitting data.
By setting up a transit device on the sending end, the data to be sent and the identification is set for each piece of data. According to the transmission configuration and preset frequency of the transit device, the data is sent to the transit device loop through the http and json protocols for storage. The receiving device accesses the transfer device through the same frequency, and acquires and stores data on the transfer device.
Data storage and synchronization are performed through the transit device, which avoids conversion errors and parsing failures caused by direct transmission, and improves the stability and integrity of data synchronization.
Smart Images

Figure CN113282665B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method, device, equipment and storage medium for data synchronization across local area networks. Background Art
[0002] With the development of computer technology and global enterprises, enterprises usually divide their internal networks into several local area networks for information security and regulatory compliance considerations, and use physical isolation between the local area networks. With the informatization construction within the group, the data relationship between information systems is becoming increasingly complex, and systems are faced with the problem of cross-local area network data synchronization.
[0003] In the prior art, when data synchronization is performed across local area networks, it is mainly achieved through the following methods: transmission in the form of files, or setting up a network gate between the public network and the local area network, formatting the files and transmitting the data using the File Transfer Protocol (FTP), so as to achieve data transmission by means of physical isolation. However, using the FTP protocol to transmit data in the form of files is not suitable for multiple small-scale incremental data transmissions. The export and import processes are prone to various problems such as character encoding conversion errors and field parsing failures. If the transmission in the form of files fails or the transmission is interrupted, the recipient will not be able to know whether the data is transmitted completely.
[0004] In summary, the data synchronization solutions across local area networks in the existing technology have relatively low integrity and stability of transmitted data. Summary of the invention
[0005] The embodiments of the present invention provide a data synchronization method, device, equipment and storage medium across local area networks, which are used to solve the problem that the integrity and stability of transmitted data are relatively low in the data synchronization scheme across local area networks in the prior art.
[0006] In a first aspect, an embodiment of the present invention provides a method for data synchronization across local area networks, which is applied to a sending end device, and the method includes:
[0007] Acquire data to be sent, and set an identifier for each piece of data in the data to be sent;
[0008] Determine the number of calls according to the transmission configuration of the transfer device, wherein the transmission configuration is used to indicate the maximum amount of data that can be sent each time, and the number of calls is used to indicate the number of cycles for sending all the data to be sent to the transfer device;
[0009] According to the preset frequency and the number of calls, the data to be sent is cyclically sent to the transfer device for storage via http and json protocols.
[0010] In a specific embodiment, the method further comprises:
[0011] Acquire the transmission configuration and a first data identifier from the transfer device, where the first data identifier is an identifier of the last piece of data successfully transmitted in the transfer device last time;
[0012] Accordingly, determining the number of calls according to the transmission configuration of the transfer device includes:
[0013] The number of calls is determined according to the transmission configuration and the first data identifier.
[0014] In a specific embodiment, the method further comprises:
[0015] Acquire the transmission configuration and a second data identifier from the transfer device, where the second data identifier is an identifier of the last piece of data stored in the transfer device;
[0016] Accordingly, determining the number of calls according to the transmission configuration of the transfer device includes:
[0017] The number of calls is determined according to the transmission configuration and the second data identifier.
[0018] In a specific implementation manner, the preset frequency is the same as the frequency at which the receiving device queries data from the transfer device.
[0019] In a second aspect, an embodiment of the present invention provides a method for data synchronization across local area networks, which is applied to a transfer device, and the method includes:
[0020] Obtain the data query request sent by the receiving device;
[0021] According to the data query request, all stored data are sent to the receiving end device using http and json protocols;
[0022] In response to the data deletion request returned by the receiving device, the locally stored data is deleted.
[0023] In a specific embodiment, the method further comprises:
[0024] If the sending of data to the receiving device is interrupted, the identifier of the last piece of data successfully sent to the sending device is recorded.
[0025] In a specific embodiment, the method further comprises:
[0026] The receiving device sends data using the http and json protocols, and stores the data in a preset order according to the identifier of each piece of data.
[0027] In a third aspect, an embodiment of the present invention provides a method for data synchronization across local area networks, which is applied to a receiving device, and the method includes:
[0028] Sending data query requests to the transfer device according to a preset frequency;
[0029] Receiving data returned by the transfer device and storing the data;
[0030] A data deletion request is sent to the transfer device, where the data deletion request is used to indicate that the receiving end has stored the data and the transfer device can delete the data.
[0031] In a specific implementation manner, the preset frequency is the same as the frequency at which the transmitting end device sends data to the transfer device.
[0032] In a fourth aspect, an embodiment of the present invention provides a data synchronization device across local area networks, including:
[0033] An acquisition module, used for acquiring data to be sent, and setting an identifier for each piece of data in the data to be sent;
[0034] A processing module, used to determine the number of calls according to the transmission configuration of the transfer device, wherein the transmission configuration is used to indicate the maximum amount of data that can be sent each time, and the number of calls is used to indicate the number of cycles for sending all the data to be sent to the transfer device;
[0035] The sending module is used to cyclically send the data to be sent to the transfer device for storage through http and json protocols according to the preset frequency and the number of calls.
[0036] In a fifth aspect, an embodiment of the present invention provides a data synchronization device across local area networks, including:
[0037] A receiving module, used to obtain a data query request sent by a receiving device;
[0038] A sending module, used to send all stored data to the receiving end device using http and json protocols according to the data query request;
[0039] The processing module is used to delete the locally stored data in response to the data deletion request returned by the receiving device.
[0040] In a sixth aspect, an embodiment of the present invention provides a data synchronization device across local area networks, including:
[0041] A sending module, used to send a data query request to the transfer device according to a preset frequency;
[0042] A receiving module, used for receiving the data returned by the transfer device and storing the data;
[0043] The sending module is further used to send a data deletion request to the transfer device, where the data deletion request is used to indicate that the receiving end has stored the data and the transfer device can delete the data.
[0044] In a seventh aspect, an embodiment of the present invention provides an electronic device, including:
[0045] Processor, memory, and interactive interface;
[0046] The memory is used to store executable instructions of the processor;
[0047] Wherein, the processor is configured to execute the cross-local area network data synchronization method described in any one of the first to third aspects by executing the executable instructions.
[0048] In an eighth aspect, an embodiment of the present invention provides a readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the cross-local area network data synchronization method described in any one of the first to third aspects is implemented.
[0049] In a ninth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the cross-local area network data synchronization method described in any one of the first to third aspects.
[0050] The cross-LAN data synchronization method, device, equipment and storage medium provided by the embodiment of the present invention, by setting a transfer device at the sending end, the sending end device obtains the data to be sent, and according to the preset frequency and the transmission configuration of the transfer device, the data to be sent is cyclically sent to the transfer device through the http and json protocols for storage, and the receiving end device accesses the transfer device through the same preset frequency to obtain the data transferred by the sending end stored on the transfer device. By setting a transfer device to temporarily store the data to be synchronized, the conversion error or parsing failure caused by direct transmission is avoided, and the data synchronization is performed in the transfer device through a small transaction method, which can also improve the stability of data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0052] Figure 1 A schematic diagram of an application scenario of the cross-local area network data synchronization method provided by an embodiment of the present invention;
[0053] Figure 2 A flowchart of a first embodiment of a method for data synchronization across local area networks provided by an embodiment of the present invention;
[0054] Figure 3 A flow chart of a second embodiment of a method for synchronizing data across local area networks provided by an embodiment of the present invention;
[0055] Figure 4 A schematic diagram of a data table in a transfer device provided in an embodiment of the present invention;
[0056] Figure 5 A schematic diagram of the structure of a first embodiment of a data synchronization device across local area networks provided by an embodiment of the present invention;
[0057] Figure 6 A schematic diagram of the structure of a second embodiment of a data synchronization device across local area networks provided by an embodiment of the present invention;
[0058] Figure 7 A schematic diagram of the structure of a third embodiment of a data synchronization device across local area networks provided by an embodiment of the present invention;
[0059] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiment of the present invention, all other embodiments made by ordinary technicians in this field under the enlightenment of this embodiment belong to the scope of protection of the present invention.
[0061] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0062] In the several prior arts provided in the background art, there are at least the following technical problems in the scheme of data synchronization across local area networks:
[0063] 1) Data security is difficult to guarantee when transferred through a third party.
[0064] 2) Using the File Transfer Protocol (FTP) in the form of files for data transmission is not suitable for multiple small-scale incremental data transmission. For structured data stored in the database, the sender and receiver need to perform data export and import operations respectively. The export and import process is prone to various problems such as character encoding conversion errors and field parsing failures.
[0065] 3) When data is transmitted in the form of files, if a server or network failure occurs and data transmission is interrupted, the receiver cannot know whether the data file is complete. After the server or network is restored, the sender cannot automatically determine from which point to retransmit, and the integrity of the data cannot be guaranteed.
[0066] 4) Data is transmitted in the form of files. If the file is too large, it is easy to face transmission timeout or transmission interruption.
[0067] In view of the above problems, the present invention proposes a data synchronization method between systems across local area networks. Under the premise of physical isolation of the network and centralized control of data transmission between networks, a transfer area and an automatic incremental update strategy are set up to achieve physical table-level data synchronization between systems across networks. The following first explains the terms involved in the present invention.
[0068] LAN: A LAN is a regional network formed in a local area, commonly used in corporate office networks. Its characteristics are fast transmission speed within the LAN, more stable performance, and it is closed.
[0069] Sending end: The sending end in the present invention refers to the source system of data transmission, and the device at the sending end is referred to as the sending end device in the document.
[0070] Receiving end: The receiving end in the present invention refers to the target system for data transmission, and the device at the receiving end is referred to as the receiving end device in the document.
[0071] Transit zone: The transit zone in the present invention refers to an intermediate system deployed between the sending end and the receiving end during the data transmission process for temporarily storing and forwarding data. The device used to implement the transit zone function is referred to as a transit device in this document.
[0072] Application service: An independently deployed web application that is used to perform specific business functions and exposes limited interfaces to the outside world.
[0073] Serialization object: The process of converting the state information of a business object into a form that can be stored or transmitted.
[0074] The core idea of the cross-LAN data synchronization method provided by the present invention is to set up a transfer area specifically used for data synchronization, that is, a transfer device, in the LAN of the sending end or the receiving end. In this way, it is only necessary to open up the network connection between the transfer device and the other party, such as the network of the sending end or the receiving end, to achieve indirect interconnection between the two LANs, thereby overcoming the above-mentioned problems that are prone to occur during data synchronization.
[0075] Figure 1 A schematic diagram of an application scenario of the cross-local area network data synchronization method provided by an embodiment of the present invention, such as Figure 1 As shown, in this scenario, taking LAN A and LAN B as two systems, when data synchronization is required, a transfer device can be set in LAN A or LAN B to realize the function of the transfer area. Figure 1 In the example, a transfer device is set in a local area network A. In this scheme, at least three devices are involved, a sending end device that sends data, a transfer device set at the sending end, and a receiving end device.
[0076] The sending device, the transfer device and the receiving device can be electronic devices such as computers and servers that have the ability to store, process and transmit data. The present invention does not limit the specific type and form of the device, and it can be configured according to actual conditions.
[0077] based on Figure 1 In the scenario shown, in this solution, the sending device is mainly used to prepare data, interact with the transit device, send data to the transit device based on the transit configuration, the transit device temporarily stores the data, and the receiving device accesses the transit device to query and obtain the temporarily stored data in the transit device and save it.
[0078] The cross-LAN data synchronization method is described in detail below through several specific implementations.
[0079] Figure 2 The flowchart of the first embodiment of the cross-local area network data synchronization method provided by the embodiment of the present invention is as follows: Figure 2 As shown, the cross-LAN data synchronization method includes the following steps:
[0080] S101: Acquire data to be sent, and set an identifier for each piece of data to be sent.
[0081] In this step, if the data of the sending device and the receiving device need to be synchronized, the sending device needs to prepare the data, at least serialize the acquired data to be sent, and set a unique identifier for the data to be sent to the transfer device for transfer, so that the sending device can determine which data has been synchronized.
[0082] S102: Determine the number of calls according to the transmission configuration of the transfer device.
[0083] In this step, after the sending device determines to synchronize data to the transfer device, it needs to obtain the transmission configuration of the transfer device. The transmission configuration is used to indicate the maximum amount of data that can be sent each time, and the number of calls is used to indicate the number of cycles for sending all the data to be sent to the transfer device.
[0084] In a specific implementation, the number of times all data can be synchronized to the transfer device can be calculated based on the amount of data to be synchronized and the transmission configuration of the transfer device.
[0085] In a specific implementation, there may be some other situations, such as transmission interruption and failure between the transfer device and the receiving device, which may cause other data to exist in the transfer device. Therefore, in the specific implementation of this step, at least the following two solutions can be used:
[0086] In a first manner, the transmission configuration and a first data identifier are obtained from the transfer device, where the first data identifier is an identifier of the last piece of data successfully transmitted in the transfer device.
[0087] In this solution, if a transmission interruption occurs due to a network failure or the like, the transfer device can record the last piece of data acquired by the receiving device, and the sending device can acquire the first data identifier while acquiring the transmission configuration.
[0088] Accordingly, the sending end device can determine the number of calls according to the transmission configuration and the first data identifier. Based on the first data identifier, it can be determined how much data is still stored in the transfer device, and then according to the maximum amount of data indicated by the transmission configuration, the amount of data that has not been sent, and the amount of data to be sent, it is determined how many times the sending end device needs to send all the data to the transfer device. This number is the number of calls in this solution.
[0089] The second method is to obtain the transmission configuration and a second data identifier from the transfer device, where the second data identifier is an identifier of the last data stored in the transfer device.
[0090] In this solution, if the transmission is interrupted due to a network failure or the like, or the data in the transfer device has not been completely deleted, the transfer device can send the identifier of the last piece of data stored to the sending device.
[0091] Correspondingly, the sending end device can calculate how many times the current amount of data needs to be synchronized to the transfer device according to the transmission configuration and the second data identifier.
[0092] In this scheme, it should be understood that the first data identifier and the second data identifier are identifiers on the transfer device side. When the transfer device receives the data and stores it according to certain data, it can record the storage order of the data and the position in the storage space. Optionally, a unique identifier can be set for each data according to the order in which the data is stored in the storage space, that is, a UUID is set in the transfer device.
[0093] S103: According to the preset frequency and the number of calls, the data to be sent is cyclically sent to the transfer device through the http and json protocols for storage.
[0094] In this step, the sending end device sends the local data to the transfer device for caching through a cyclic calling method according to the predetermined frequency and the number of calls calculated above.
[0095] For the transfer device, it receives the data sent by the sending device using the http and json protocols, and stores the data in a preset order according to the identifier of each piece of data.
[0096] In this solution, the transfer device can set labels for the data locally according to the storage order. For example, if the transfer device can store 10 pieces of data, it can be identified by numbers 1-10. After the sending end device sends 10 or less pieces of data to the transfer device each time, the receiving end device can delete the 10 pieces of data stored in it and continue to receive subsequent data after reading all the 10 pieces of data to the receiving end. In the technical solution of the present invention, the main function of the transfer device is to temporarily store data.
[0097] In this embodiment, the transfer device is set at the sending end, so any sending end device can transmit data through the internal network in the local area network, and it only needs to open the line between the transfer device and the receiving end device. If the transfer device is set in the local area network of the receiving end, it only needs to open the line between the sending end device and the transfer device.
[0098] In the transfer device, if the data transmission to the receiving device is interrupted, the identifier of the last piece of data successfully transmitted to the transmitting device is recorded, and the identifier of the last piece of data can be subsequently transmitted to the transmitting device together with the transmission configuration.
[0099] S104: Sending a data query request to the transfer device according to a preset frequency.
[0100] S105: According to the data query request, all stored data are sent to the receiving device using http and json protocols.
[0101] At the receiving end, the receiving device sends a data query request to the transfer device according to the preset frequency to request data. The transfer device returns all the data to the receiving device using the http and json protocols based on the received query request.
[0102] The receiving device receives the data returned by the transfer device and stores the data.
[0103] S106: Send a data deletion request to the transfer device.
[0104] In this step, after the receiving device successfully obtains the data and stores the data, it needs to indicate to the transfer device that the data has been synchronized to the receiving device so that the transfer device can clear the memory space. That is, in this solution, the data deletion request is used to indicate that the receiving end has stored the data, and the transfer device can delete the data.
[0105] S107: In response to the data deletion request returned by the receiving device, the locally stored data is deleted.
[0106] In this step, after receiving the data deletion request, the transfer device can delete the data that has been successfully synchronized to the receiving end device, clearing up storage space to continue to transfer the subsequent data synchronized from the sending end.
[0107] In an optional implementation of the entire above solution, in order to improve the efficiency of data synchronization, the frequency of the transmitting device cyclically synchronizing data to the transit device may be consistent with the frequency of the receiving device accessing the transit device to obtain data.
[0108] That is, at the transmitting end, the cyclic call frequency set by the transmitting end device is the same as the frequency at which the receiving end device queries data from the transfer device. At the receiving end, the access data frequency set by the receiving end device is the same as the frequency at which the transmitting end device sends data to the transfer device.
[0109] The cross-LAN data synchronization method provided in this embodiment sets a transfer device at the sending end, and the sending end device obtains the data to be sent. According to the preset frequency and the transmission configuration of the transfer device, the data to be sent is cyclically sent to the transfer device through the http and json protocols for storage. The receiving end device accesses the transfer device through the same preset frequency to obtain the data transferred by the sending end stored on the transfer device. By setting a transfer device to temporarily store the data to be synchronized, the conversion error or parsing failure caused by direct transmission is avoided. The data synchronization is performed in the transfer device through small transactions, which can also improve the stability of data synchronization.
[0110] Figure 3 The flowchart of the second embodiment of the cross-local area network data synchronization method provided by the embodiment of the present invention is as follows: Figure 3 As shown, the specific implementation process of the cross-LAN data synchronization method is as follows:
[0111] (1) The sending device triggers the data sending operation according to the preset data synchronization frequency. According to the last "data tag" successfully transmitted by the transfer device and the maximum number of records sent at one time of the "transmission configuration", the incremental data range and the number of loop calls to be sent this time are determined, and then the data temporary storage service of the transfer device is called cyclically. The data is sent and saved to the transfer database in the transfer device through the encrypted http protocol transmission method. After each call is completed, the data tag on the transfer device is synchronously updated.
[0112] (2) The receiving device triggers data query and local storage operations according to the preset data synchronization frequency. Query all data on the transfer device, determine the number of loop calls based on the maximum number of records obtained at one time, and loop call the data query service of the transfer server in an encrypted HTTP protocol transmission mode to obtain the data in the transfer database and store it locally.
[0113] The data storage service of the transfer device can realize the atomicity of transactions through underlying technologies such as SpringBoot. For example, if 1,000 records are to be sent at a time, if a problem occurs during the sending process, the executed operations will be automatically rolled back to the state before the current sending.
[0114] In order to simplify the processing logic of the data receiving device, each time the receiving device successfully saves a batch of data, it calls the data deletion service to delete the batch of data from the transit database in the transit device, so that the full amount of data in the transit device can be directly obtained next time.
[0115] 3) In order to achieve automatic retransmission and ensure the consistency of data between the sender and the receiver, the transfer device requires that the transmitted data be ordered and adds a special table to record the last piece of data successfully transmitted. Figure 4 Schematic diagram of a data table in a transfer device provided in an embodiment of the present invention. Figure 4 In the table shown, the sending device sorts the data to be sent as a whole and sends the data in order. At the end of each data transmission, the transfer device will mark and save the most recent data that has been successfully sent. For example, if the data to be sent has a system operation time field, the transfer area marks the system operation time of the last successfully sent data. If the data to be sent does not have an operation time field, another marking field is required, such as a primary key with an incremental attribute. The sender can accurately determine the incremental data range for the next transmission based on this "data mark".
[0116] This function not only meets the requirements of daily data transmission, but is also applicable to situations where data transmission is interrupted due to transit equipment or network failure. The entire process does not require human intervention.
[0117] 4) If the incremental data generated at one time is large, the file transfer method is likely to fail due to the large size of the data file. In the present invention, the equipment in the transfer area adopts the small transaction submission method to limit the maximum number of records sent at one time. One synchronization and multiple transmissions ensure the stability of data transmission.
[0118] The cross-LAN data synchronization method provided by the present invention performs data synchronization by setting a transfer device and deploying an application service based on the http+json protocol and a database for temporarily storing data on it, thereby solving the problem of data format conversion in the file transmission method. Through "data marking", automatic data continuation is achieved, the robustness of data synchronization is guaranteed, and no manual intervention is required in the transmission process. The submission method of small transactions during the data synchronization process limits the maximum amount of data sent and obtained at one time, while ensuring the atomicity of each operation, thereby increasing the stability of data synchronization.
[0119] Generally speaking, the technical solution provided by the present invention implements the transit area service design and operation process for data synchronization between systems under a network isolation architecture, and under the above-mentioned architectural design, is a technical method for ensuring the robustness and stability of data synchronization.
[0120] Figure 5 A schematic diagram of the structure of a first embodiment of a data synchronization device across local area networks provided by an embodiment of the present invention; Figure 5 As shown, the cross-LAN data synchronization device 10 includes:
[0121] The acquisition module 11 is used to acquire the data to be sent and set an identifier for each piece of data in the data to be sent;
[0122] The processing module 12 is used to determine the number of calls according to the transmission configuration of the transfer device, wherein the transmission configuration is used to indicate the maximum amount of data that can be sent each time, and the number of calls is used to indicate the number of cycles for sending all the data to be sent to the transfer device;
[0123] The sending module 13 is used to cyclically send the data to be sent to the transfer device for storage through http and json protocols according to the preset frequency and the number of calls.
[0124] Optionally, the acquisition module 11 is further used to acquire the transmission configuration and a first data identifier from the transfer device, where the first data identifier is an identifier of the last piece of data successfully transmitted in the transfer device last time;
[0125] Accordingly, the processing module 12 is specifically used for:
[0126] The number of calls is determined according to the transmission configuration and the first data identifier.
[0127] Optionally, the acquisition module 11 is further used to acquire the transmission configuration and a second data identifier from the transfer device, where the second data identifier is an identifier of the last piece of data stored in the transfer device;
[0128] Accordingly, the processing module 12 is specifically used for:
[0129] The number of calls is determined according to the transmission configuration and the second data identifier.
[0130] Optionally, the preset frequency is the same as the frequency at which the receiving device queries data from the transfer device.
[0131] The cross-LAN data synchronization device provided in this embodiment is used to execute the technical solution of the sending end device in any of the aforementioned method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0132] Figure 6 A schematic diagram of the structure of a second embodiment of a data synchronization device across local area networks provided by an embodiment of the present invention; Figure 6 As shown, the cross-LAN data synchronization device 20 includes:
[0133] Receiving module 21, used to obtain the data query request sent by the receiving end device;
[0134] The sending module 22 is used to send all the stored data to the receiving end device using the http and json protocols according to the data query request;
[0135] The processing module 23 is used to delete the locally stored data in response to the data deletion request returned by the receiving device.
[0136] Optionally, the processing module 23 is further used for:
[0137] If the sending of data to the receiving device is interrupted, the identifier of the last piece of data successfully sent to the sending device is recorded.
[0138] Optionally, the receiving module 21 is further used for:
[0139] The receiving device sends data using the http and json protocols, and stores the data in a preset order according to the identifier of each piece of data.
[0140] The cross-LAN data synchronization device provided in this embodiment is used to execute the technical solution of the transfer device in any of the aforementioned method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0141] Figure 7 A schematic diagram of the structure of a third embodiment of a data synchronization device across local area networks provided by an embodiment of the present invention; Figure 7 As shown, the cross-LAN data synchronization device 30 includes:
[0142] The sending module 31 is used to send a data query request to the transfer device according to a preset frequency;
[0143] The receiving module 32 is used to receive the data returned by the transfer device and store the data;
[0144] The sending module 31 is further used to send a data deletion request to the transfer device, where the data deletion request is used to indicate that the receiving end has stored the data and the transfer device can delete the data.
[0145] Optionally, the preset frequency is the same as the frequency at which the sending end device sends data to the transfer device.
[0146] The cross-LAN data synchronization device provided in this embodiment is used to execute the technical solution of the receiving device in any of the aforementioned method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0147] Figure 8 FIG. 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 8 As shown, the electronic device 100 includes:
[0148] Processor 111, memory 112, and interactive interface 113;
[0149] The memory 112 is used to store executable instructions of the processor 111;
[0150] The processor 111 is configured to execute the technical solution of any execution subject in the aforementioned cross-local area network data synchronization method by executing the executable instructions.
[0151] Optionally, the memory 112 may be independent or integrated with the processor 111 .
[0152] Optionally, when the memory 112 is a device independent of the processor 111, the electronic device 100 may further include:
[0153] A bus is used to connect the above devices.
[0154] The electronic device is used to execute the technical solution of any execution subject provided by any of the aforementioned method embodiments. In a specific implementation, the electronic device can be implemented as a sending device, a transit device or a receiving device. Its implementation principle and technical effects are similar to those in the aforementioned method embodiments and will not be repeated here.
[0155] An embodiment of the present invention further provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the cross-local area network data synchronization method provided by any of the aforementioned embodiments is implemented.
[0156] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the cross-local area network data synchronization method provided by any of the aforementioned method embodiments.
[0157] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data synchronization method across local area networks, characterized in that: Applied to a transmitting device, the method comprises: Acquire data to be sent, and perform serialization processing on the data to be sent to set an identifier for each piece of data in the data to be sent; The data sending operation is triggered periodically according to the preset data synchronization frequency. After determining to synchronize data to the transfer device, if the transfer device interrupts sending data to the receiving device, the incremental data range and the number of loop calls for this sending are determined according to the last data mark of the last successful transmission recorded by the transfer device and the transmission configuration. The transmission configuration is used to indicate the maximum amount of data that can be sent each time, and the number of calls is used to indicate the number of cycles for sending all the data to be sent to the transfer device; wherein the transfer device and the sending device are not in the same local area network; if the data in the transfer device has not been deleted, the transmission configuration and the second data identifier are obtained from the transfer device, the second data identifier being the identifier of the last data stored in the transfer device; the number of calls is determined according to the transmission configuration and the second data identifier; According to the preset frequency and the number of calls, the data to be sent is cyclically sent to the transfer device for storage via http and json protocols.
2. The method according to claim 1, characterized in that The preset frequency is the same as the frequency at which the receiving device queries data from the transfer device.
3. A data synchronization method across local area networks, characterized in that: Applied to a transfer device, the method comprises: Obtain a data query request sent by a receiving device at a preset frequency; the preset frequency is the same as a cyclic call frequency set by the sending device; according to the data query request, all stored data is sent to the receiving device using http and json protocols; In response to the data deletion request returned by the receiving device, deleting the locally stored data; The method further comprises: If the sending of data to the receiving device is interrupted, recording the identifier of the last piece of data successfully sent to the sending device; If the data in the transfer device has not been deleted, obtain the identifier of the last piece of data stored in the transfer device.
4. The method according to claim 3, characterized in that The method further comprises: The receiving device sends data using the http and json protocols, and stores the data in a preset order according to the identifier of each piece of data.
5. A data synchronization device across local area networks, characterized in that: include: An acquisition module, used for acquiring data to be sent, and performing serialization processing on the data to be sent to set an identifier for each piece of data in the data to be sent; A processing module, used for timingly triggering a data sending operation according to a preset data synchronization frequency; after determining to synchronize data to a transfer device, if the transfer device interrupts sending data to a receiving device, the incremental data range and the number of cyclic calls for this sending are determined according to the mark of the last data successfully transmitted last time recorded by the transfer device and the transmission configuration, wherein the transmission configuration is used to indicate the maximum amount of data that can be sent each time, and the number of calls is used to indicate the number of cycles for sending all the data to be sent to the transfer device; wherein the transfer device and the sending device are not in the same local area network; if the data in the transfer device has not been deleted, the transmission configuration and a second data identifier are obtained from the transfer device, wherein the second data identifier is the identifier of the last data stored in the transfer device; the number of calls is determined according to the transmission configuration and the second data identifier; The sending module is used to cyclically send the data to be sent to the transfer device for storage through http and json protocols according to the preset frequency and the number of calls.
6. A data synchronization device across local area networks, characterized in that: include: A receiving module, used to obtain a data query request sent by a receiving device at a preset frequency; The preset frequency is the same as the cyclic calling frequency set by the sending end device; A sending module, used to send all stored data to the receiving end device using http and json protocols according to the data query request; A processing module is used to delete the locally stored data in response to the data deletion request returned by the receiving device; if the sending of data to the receiving device is interrupted, record the identifier of the last data successfully sent to the sending device; if the data in the transfer device has not been deleted, obtain the identifier of the last data stored in the transfer device.
7. An electronic device, characterized in that: include: Processor, memory, and interactive interface; The memory is used to store executable instructions of the processor; The processor is configured to execute the cross-local area network data synchronization method according to any one of claims 1 to 3 by executing the executable instructions.
8. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cross-local area network data synchronization method described in any one of claims 1 to 3 is implemented.
9. A computer program product, characterized in that It comprises a computer program, which is used to implement the cross-local area network data synchronization method as claimed in any one of claims 1 to 3 when executed by a processor.
Citation Information
Patent Citations
Method, device and transmission system for sending, transferring and receiving message document
CN101510893A