CN102223378A - File synchronization method and system - Google Patents
File synchronization method and system Download PDFInfo
- Publication number
- CN102223378A CN102223378A CN2011101764269A CN201110176426A CN102223378A CN 102223378 A CN102223378 A CN 102223378A CN 2011101764269 A CN2011101764269 A CN 2011101764269A CN 201110176426 A CN201110176426 A CN 201110176426A CN 102223378 A CN102223378 A CN 102223378A
- Authority
- CN
- China
- Prior art keywords
- file
- rtp message
- message
- server
- server end
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Abstract
The invention discloses a file synchronization method and a system. The method is suitable for the condition that a jumping machine is needed for communicating a local network and a destination server network, a computer of the local network is provided with a client terminal, and the jumping machine is provided with a server terminal. The method comprises the following steps that network connection is set up between the client terminal and server terminal; the client terminal is provided with a monitoring file folder path; if files in the monitoring file folder change, the client terminal puts the destination server information, the changed files and operation orders into a real-time file transport protocol message, and transmits the message to the server terminal; the server terminal analyzes the real-time file transport protocol message to obtain corresponding operation information; and on the destination server, the server terminal carries out corresponding operation on the changed files according to the operation orders, and after the operation is completed, an operation completion indication message is replied to the client terminal. The technical scheme provided by the invention can improve the efficiency of carrying out file synchronization among different networks.
Description
Technical field
The present invention relates to the file transfer field of synchronization in the Internet, particularly a kind of file synchronisation method and system.
Background technology
Existing file transfer simultaneous techniques all is that to be based upon two machinery compartment networks be under the condition of directly intercommunication, yet in real work and using, owing to there is the situation of the no longer same network of server room and operational environment, intermediate demand passes through public the Internet, cause the local terminal can not be directly and server be communicated with, upload files etc. are transferred to the redirect machine earlier for the action need of remote server from this locality, and then from twice manual operation that server is in transit in jumping, waste time and energy.
In sum, file synchronisation method of the prior art needs to be transferred to from this locality earlier the redirect machine in the upload file process, and then from twice manual operation that server is in transit in jumping, wastes time and energy.
Summary of the invention
The invention provides a kind of file synchronisation method, this method can improve the efficient of carrying out file synchronization between heterogeneous networks.
The present invention also provides a kind of file syn chronizing system, and this system can improve the efficient of carrying out file synchronization between heterogeneous networks.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention discloses a kind of file synchronisation method, this method is applicable to needs situation about being communicated with by the redirect machine between local network and the destination server network, wherein, on the computer of local network, client is installed, on the redirect machine, server end is installed; This method comprises:
Set up client and be connected, the monitoring folder path is set on client with network between the server end;
If the file in the described monitoring file changes, client is put into file RTP message with the file and the operational order of destination server information, change, sends to server end;
Server end obtains the file and the operational order of destination server information, described change by resolving described file RTP message;
Server end carries out corresponding operating according to described operational order file to described change on destination server, replys operation to client after operation is finished and finishes prompting message.
The invention also discloses a kind of file syn chronizing system, this system is applicable to needs situation about being communicated with by the redirect machine between local network and the destination server network, wherein, this system comprises: be installed in local client, be installed in the server end on the redirect machine, wherein
Whether client is used to monitor local file and changes, if local file changes, file RTP message is put in the described file packing that changes, and sends to server end;
Server end is used for the file RTP message according to the client transmission, parses file and the operational order of obtaining destination server information, described change; Operate accordingly on destination server according to described operational order.
From the above, technical scheme of the present invention can directly be carried out file synchronization at the webserver that can not directly be communicated with, technical scheme provided by the invention is by monitoring local specified folder automatically, the file file RTP message that changes is sent to the server end that is installed on the redirect machine, this server end can be sought the corresponding target server automatically, specified folder on destination server is operated accordingly, and feedback operation result, without manual operation, improved efficient, the manpower of saving and time.
Description of drawings
Fig. 1 is the flow chart of a kind of file synchronisation method among the present invention;
Fig. 2 is the detail flowchart of a kind of file synchronisation method among the present invention;
Fig. 3 is the structural representation of file syn chronizing system always among the present invention.
Embodiment
Fig. 1 is the flow chart of a kind of file synchronisation method among the present invention, as shown in Figure 1,
Step 101 is set up client and is connected with network between the server end, and the monitoring folder path is set.
Step 102 if the file in the described monitoring file changes, is put into file RTP message with the file that changes, and sends to server end.
Step 103 by resolving described file RTP message, is obtained the file and the operational order of destination server information, described change.
Step 104 is carried out corresponding operating according to described operational order at destination server, replys operation after operation is finished and finishes prompting message.
In order to make the purpose, technical solutions and advantages of the present invention clearer, describe the present invention below in conjunction with the drawings and specific embodiments.
The technical scheme that provides among the present invention is applicable to, can not directly be communicated with between local network and the destination server network, local file is synchronized to be needed in the destination server to operate by the redirect machine, wherein, in a kind of file synchronisation method provided by the invention, in this locality client is installed, in the redirect machine, server end is installed.
Fig. 2 is the detail flowchart of a kind of file synchronisation method among the present invention, as shown in Figure 2,
Step 201 starts client, and the path of monitoring file is set; In this step, start policer operation to the monitoring file after, set up a Socket between client and the server end and be connected.
Step 202, client is monitored the monitoring file, file changes in the file if monitor, then the triggering synchronous flow process.Wherein, file changes and comprises in the described monitoring file: file increases, file deletion and file modification.
Step 203, client is put into the main part of file RTP message with the file that changes, and adds a plurality of message headers in described file RTP message; Described file RTP message of having added message header is sent to server end.Wherein, if the file in the described monitoring file increases, the file of described increase is put into file RTP message; If the file modification in the described monitoring file is put into file RTP message with the file of described modification; If the file in described monitoring file deletion is put into file RTP message with the filename of the file of described deletion.
In this step, carry an essential information in the message header, the information of carrying in the message header that is added has: be used to deposit storing directory, the operating system of destination server, the type of destination server and the operational order of carrying out corresponding operating that changes file in the network address of destination server, the destination server; In other embodiments of the invention, can carry out function to described message header according to the actual requirements expands.
Step 204, server end receives the file RTP message from client, and described file RTP message is resolved, and parses the file of information, operational order and the described change of described destination server; The information of described destination server comprises: be used to deposit the storing directory that changes file, the operating system of destination server, the type of destination server in the network address of destination server, the destination server.
The network address of the destination server that server end obtains according to parsing, set up with destination server between network be connected, the OS Type of the destination server that obtains according to parsing adopts dos command, SSH safety shell protocol or SFTP Secure File Transfer Protocol to carry out corresponding operating.Wherein, if the window system adopts dos command to operate, if linux system adopts modes such as SSH or SFTP to operate.
Server end is operated accordingly according to the operational order that parsing obtains: if described operational order increases described file for increasing in the storing directory in destination server; If described operational order is for revising, in the storing directory in destination server original replaced to described file; If described operational order is deleted original in the storing directory in destination server for deletion.
Step 205, server end judge whether the operation on destination server is successful, if operate successfully, then carry out step 206; If operation is unsuccessful, then carry out step 204.
Step 206, server end send to client with the information of complete operation by file RTP message after being operable to merit on the destination server; After client was resolved the described file RTP message that receives, the operation of affirmation file synchronization was finished.
In a preferred embodiment of the present invention, a kind of form of file RTP message is provided, as shown in table 1.
First byte |
Message header [numbering of message header, the length of message header, the value of message header] |
Message header [numbering of message header, the length of message header, the value of message header] |
Message header [numbering of message header, the length of message header, the value of message header] |
....... |
Main part [numbering of main body, the length of main body, the value of main body] |
Main part [numbering of main body, the length of main body, the value of main body] |
....... |
Terminating symbol |
Table 1
As shown in table 1, the message header and a plurality of main part that comprised in the described file RTP message, wherein message header is used to deposit the network address of destination server, the storing directory of destination server etc., and main part is used to deposit corresponding file or filename; Being used to distinguish this document RTP message at the highest-order bit of first byte is the request that client sends to server end, and still server end sends to the response of client, and other positions are used to represent corresponding operation mode; It is as shown in table 2,
Table 2
It is the request that client sends to server end that the 7th wherein the highest bit is used to distinguish this document RTP message, or server end sends to the response of client; Remaining bit is used to represent corresponding operation mode.
In an embodiment of the present invention, the value of the 7th bit is that the described file RTP message of 0 expression is the request that client sends to server end, the value that the back is 7 is that the described operational order of 01 expression is for increasing, the value that the back is 7 is that the described operational order of 02 expression is deletion, and back 7 value is that the described operational order of 03 expression is change; And can define new operational order as the case may be.
The value of the 7th bit is that the described file RTP message of 1 expression is the response that server end sends to client; Wherein, back 7 value is that the described response of 80 expressions is for to operate successfully; The value that the back is 7 is that the described response of 81 expressions is the destination server inertia, 7 the value in back is 82 to be expressed as and mistake occurs, the value that the back is 7 is that 83 expression destination servers are busy, and back 7 value is that 84 expression destination servers do not exist, and back 7 value is that 85 expressions connect; And can define new response code as the case may be.
The present invention also provides a kind of file syn chronizing system, and this system is applicable to needs situation about being communicated with by the redirect machine between local network and the destination server network; Fig. 3 is the structural representation of a kind of file syn chronizing system among the present invention, and as shown in Figure 3, this system comprises: be installed in local client 301, be installed in the server end 302 on the redirect machine, wherein,
Whether client 301 is used to monitor local file and changes, if local file changes, file RTP message is put in the described file packing that changes, and sends to server end 302;
Server end 302 is used for the file RTP message according to client 301 transmissions, parses file and the operational order of obtaining destination server 303 information, described change; Operate accordingly on destination server 303 according to described operational order.
In said system, described system comprises a plurality of clients 301, and the path of monitoring file is set in described client 301,
If the file in the described monitoring file increases, the file of described increase is put into file RTP message, send to server end 302;
If the file modification in the described monitoring file is put into file RTP message with the file of described modification, send to server end 302;
If the file in described monitoring file deletion is put into file RTP message with the filename of the file of described deletion, send to server end 302.
In said system, if the file of client 301 in described monitoring file increases or revise, then client 301 is put into described file in the main part of described file RTP message; If the deletion of the file in the described monitoring file, then client 301 is put into the filename of deleted file in the main part of described file RTP message;
Client 301 is added a plurality of message headers in described file RTP message, carry destination server 303 information and operational order in the described message header, and the file RTP message of having added message header is sent to server end 302.
In said system, server end 302 is resolved the file RTP message that receives, according to the operational order of carrying in the described file RTP message, in destination server 303, operate accordingly, wherein:
If described operational order increases described file for increasing in the storing directory in destination server 303;
If described operational order is for revising, in the storing directory in destination server 303 original replaced to described file;
If described operational order is deleted original in the storing directory in destination server 303 for deletion.
In said system, server end 302 is resolved the described file RTP message that receives, according to the OS Type of the destination server 303 that carries in the described file RTP message, adopt dos command, SSH safety shell protocol or SFTP Secure File Transfer Protocol to carry out corresponding operating.
In native system, the redirect machine that server end is installed can support the client more than 10 simultaneously a plurality of servers to be carried out the file synchronization operation.
From the above, technical scheme of the present invention can directly be carried out file synchronization at the webserver that can not directly be communicated with, technical scheme provided by the invention is by monitoring local specified folder automatically, the file file RTP message that changes is sent to the server end that is installed on the redirect machine, this server end can be sought the corresponding target server automatically, specified folder on destination server is operated accordingly, and feedback operation result, without manual operation, improved efficient, the manpower of saving and time.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being made, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.
Claims (10)
1. file synchronisation method, it is characterized in that this method is applicable to needs situation about being communicated with by the redirect machine between local network and the destination server network, wherein, on the computer of local network, client is installed, on the redirect machine, server end is installed; This method comprises:
Set up client and be connected, the monitoring folder path is set on client with network between the server end;
If the file in the described monitoring file changes, client is put into file RTP message with the file and the operational order of destination server information, change, sends to server end;
Server end obtains the file and the operational order of destination server information, described change by resolving described file RTP message;
Server end carries out corresponding operating according to described operational order file to described change on destination server, replys operation to client after operation is finished and finishes prompting message.
2. method according to claim 1 is characterized in that, if the file in the described monitoring file changes, the file that changes is put into file RTP message, sends to server end and comprises:
If the file in the described monitoring file increases, the file of described increase is put into file RTP message, send to server end;
If the file modification in the described monitoring file is put into file RTP message with the file of described modification, send to server end;
If the file in described monitoring file deletion is put into file RTP message with the filename of the file of described deletion, send to server end.
3. method according to claim 2 is characterized in that, the file that changes is put into file RTP message, sends to server end and comprises:
If the file in the described monitoring file increases or revises, then in the main part of described file RTP message, put into described file; If the file in the described monitoring file is deleted, in the main part of described file RTP message, put into the filename of deleted file;
In described file RTP message, add a plurality of message headers, carry destination server information and operational order in the described message header, the file RTP message of having added message header is sent to server end.
4. method according to claim 3 is characterized in that, described server end carries out corresponding operating to the file of described change according to described operational order and comprises on destination server:
If described operational order increases described file for increasing in the storing directory in destination server;
If described operational order is for revising, in the storing directory in destination server original replaced to described file;
If described operational order is deleted original in the storing directory in destination server for deletion.
5. method according to claim 4 is characterized in that, describedly carries out corresponding operating according to described operational order at destination server and comprises:
Resolve the described file RTP message that receives, according to the OS Type of the destination server that carries in the described file RTP message, adopt dos command, SSH safety shell protocol or SFTP Secure File Transfer Protocol to carry out corresponding operating.
6. a file syn chronizing system is characterized in that, this system is applicable to needs situation about being communicated with by the redirect machine between local network and the destination server network, wherein, this system comprises: be installed in local client, be installed in the server end on the redirect machine, wherein
Whether client is used to monitor local file and changes, if local file changes, file RTP message is put in the described file packing that changes, and sends to server end;
Server end is used for the file RTP message according to the client transmission, parses file and the operational order of obtaining destination server information, described change; Operate accordingly on destination server according to described operational order.
7. system according to claim 6 is characterized in that,
Described system comprises a plurality of clients, and the path of monitoring file is set in described client,
If the file in the described monitoring file increases, the file of described increase is put into file RTP message, send to server end;
If the file modification in the described monitoring file is put into file RTP message with the file of described modification, send to server end;
If the file in described monitoring file deletion is put into file RTP message with the filename of the file of described deletion, send to server end.
8. system according to claim 7 is characterized in that,
If the file in the described monitoring file increases or revises, then client is put into described file in the main part of described file RTP message; If the deletion of the file in the described monitoring file, then client is put into the filename of deleted file in the main part of described file RTP message;
Client is added a plurality of message headers in described file RTP message, carry destination server information and operational order in the described message header, and the file RTP message of having added message header is sent to server end.
9. system according to claim 8 is characterized in that,
Server end is resolved the file RTP message that receives, according to the operational order of carrying in the described file RTP message, in destination server, operates accordingly, wherein:
If described operational order increases described file for increasing in the storing directory in destination server;
If described operational order is for revising, in the storing directory in destination server original replaced to described file;
If described operational order is deleted original in the storing directory in destination server for deletion.
10. system according to claim 9 is characterized in that,
Server end is resolved the described file RTP message that receives, according to the OS Type of the destination server that carries in the described file RTP message, adopt dos command, SSH safety shell protocol or SFTP Secure File Transfer Protocol to carry out corresponding operating.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110176426.9A CN102223378B (en) | 2011-06-28 | 2011-06-28 | File synchronization method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110176426.9A CN102223378B (en) | 2011-06-28 | 2011-06-28 | File synchronization method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102223378A true CN102223378A (en) | 2011-10-19 |
CN102223378B CN102223378B (en) | 2014-01-29 |
Family
ID=44779806
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110176426.9A Active CN102223378B (en) | 2011-06-28 | 2011-06-28 | File synchronization method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102223378B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102638569A (en) * | 2012-01-13 | 2012-08-15 | 深圳市同洲视讯传媒有限公司 | File distribution synchronizing method and system |
CN102790802A (en) * | 2012-06-28 | 2012-11-21 | 新浪网技术(中国)有限公司 | Method and system for saving file into micro disk |
CN103106677A (en) * | 2011-11-14 | 2013-05-15 | 北大方正集团有限公司 | Processing method and processing system of full-page proof result output file |
CN103473341A (en) * | 2013-09-23 | 2013-12-25 | 网易(杭州)网络有限公司 | Playing list generating method and equipment |
CN103973772A (en) * | 2014-04-02 | 2014-08-06 | 小米科技有限责任公司 | File reading and writing method and device |
CN106919574A (en) * | 2015-12-24 | 2017-07-04 | 中国科学院深圳先进技术研究院 | A kind of method of real-time processing remote synchronization file |
CN110019104A (en) * | 2018-12-11 | 2019-07-16 | 阿里巴巴集团控股有限公司 | File resource exchanges method, file resource server and document exchange system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020120791A1 (en) * | 2001-02-28 | 2002-08-29 | Mobiliti, Inc. | Application independent write monitoring method for fast backup and synchronization of open files |
CN101453418A (en) * | 2007-12-05 | 2009-06-10 | 高德软件有限公司 | Updating method for synchronization between customer terminal and server |
CN101577817A (en) * | 2009-06-10 | 2009-11-11 | 中兴通讯股份有限公司 | Distributed video monitoring system and method thereof for keeping data consistency |
CN101771548A (en) * | 2008-12-29 | 2010-07-07 | 深圳市维信联合科技有限公司 | File synchronizing method and system |
-
2011
- 2011-06-28 CN CN201110176426.9A patent/CN102223378B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020120791A1 (en) * | 2001-02-28 | 2002-08-29 | Mobiliti, Inc. | Application independent write monitoring method for fast backup and synchronization of open files |
CN101453418A (en) * | 2007-12-05 | 2009-06-10 | 高德软件有限公司 | Updating method for synchronization between customer terminal and server |
CN101771548A (en) * | 2008-12-29 | 2010-07-07 | 深圳市维信联合科技有限公司 | File synchronizing method and system |
CN101577817A (en) * | 2009-06-10 | 2009-11-11 | 中兴通讯股份有限公司 | Distributed video monitoring system and method thereof for keeping data consistency |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103106677A (en) * | 2011-11-14 | 2013-05-15 | 北大方正集团有限公司 | Processing method and processing system of full-page proof result output file |
CN102638569A (en) * | 2012-01-13 | 2012-08-15 | 深圳市同洲视讯传媒有限公司 | File distribution synchronizing method and system |
CN102638569B (en) * | 2012-01-13 | 2014-10-29 | 深圳市同洲电子股份有限公司 | File distribution synchronizing method and system |
CN102790802A (en) * | 2012-06-28 | 2012-11-21 | 新浪网技术(中国)有限公司 | Method and system for saving file into micro disk |
CN103473341A (en) * | 2013-09-23 | 2013-12-25 | 网易(杭州)网络有限公司 | Playing list generating method and equipment |
CN103973772A (en) * | 2014-04-02 | 2014-08-06 | 小米科技有限责任公司 | File reading and writing method and device |
CN103973772B (en) * | 2014-04-02 | 2016-02-24 | 小米科技有限责任公司 | File read/write method and device |
CN106919574A (en) * | 2015-12-24 | 2017-07-04 | 中国科学院深圳先进技术研究院 | A kind of method of real-time processing remote synchronization file |
CN106919574B (en) * | 2015-12-24 | 2021-06-15 | 杭州中科先进技术研究院有限公司 | Method for processing remote synchronous file in real time |
CN110019104A (en) * | 2018-12-11 | 2019-07-16 | 阿里巴巴集团控股有限公司 | File resource exchanges method, file resource server and document exchange system |
CN110019104B (en) * | 2018-12-11 | 2023-06-23 | 阿里巴巴集团控股有限公司 | File resource exchange method, file resource server and file exchange system |
Also Published As
Publication number | Publication date |
---|---|
CN102223378B (en) | 2014-01-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102223378B (en) | File synchronization method and system | |
CN107465767B (en) | Data synchronization method and system | |
CN101577722B (en) | Method for realizing MAC forced forwarding function and device | |
CN102333128B (en) | Active transmission method for real-time Web data | |
CN102355479B (en) | Method and equipment for forwarding traffic of multi-NAT (network address translation) gateway | |
CN101136730A (en) | Credible synchronization method of distributed network equipment | |
CN104954281A (en) | Communication method, system thereof, resource pool management system, switches, and control device | |
WO2018166415A1 (en) | Cloud storage system, media data storage method and system | |
CN106326308B (en) | Data de-duplication method and system in a kind of net based on SDN | |
CN103747091A (en) | Distributed data synchronization system and method for embedded equipment | |
CN104980355A (en) | Source controllable multicast data transmission method and system thereof under SDN Environment | |
CN103259866B (en) | A kind of method and system of DNS zone file multi-node transmission | |
CN103546572A (en) | Cloud storage device and multi-cloud storage networking system and method | |
CN102404387A (en) | Method, device and equipment for information synchronization with other nodes | |
CN105472024A (en) | Cross-region data synchronizing method based on message pushing mode | |
WO2016086478A1 (en) | Active synchronization method and system for rpki data | |
CN104954101A (en) | Multi-terminal data synchronization method based on ACK synchronization | |
CN101895475B (en) | Graceful restart method based on PIM SM protocol and system thereof | |
CN103281317B (en) | A kind of attack testing method of software defined network | |
CN101056195A (en) | Data synchronization method between the main board and spare board in the communication system | |
CN105790985B (en) | Data switching method, first device, second device and system | |
CN101335610B (en) | ARP synchronization method in high-side Ethernet network switch | |
CN103384218A (en) | Flow forward method and system on basis of service grade | |
CN105656959A (en) | Multi-terminal PUB/SUB (Publish/Subscribe) message synchronization method based on routing mechanism | |
JP6571400B2 (en) | Router device, redundancy method and redundancy program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CP02 | Change in the address of a patent holder |
Address after: Room 810, 8 / F, 34 Haidian Street, Haidian District, Beijing 100080 Patentee after: BEIJING D-MEDIA COMMUNICATION TECHNOLOGY Co.,Ltd. Address before: 100089 Beijing city Haidian District wanquanzhuang Road No. 28 Wanliu new building A block 5 layer Patentee before: BEIJING D-MEDIA COMMUNICATION TECHNOLOGY Co.,Ltd. |
|
CP02 | Change in the address of a patent holder |