CN106301747A - The realization method and system of bi-directional synchronization between a kind of router - Google Patents

The realization method and system of bi-directional synchronization between a kind of router Download PDF

Info

Publication number
CN106301747A
CN106301747A CN201610874496.4A CN201610874496A CN106301747A CN 106301747 A CN106301747 A CN 106301747A CN 201610874496 A CN201610874496 A CN 201610874496A CN 106301747 A CN106301747 A CN 106301747A
Authority
CN
China
Prior art keywords
router
thread
file
provides
synchronization
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610874496.4A
Other languages
Chinese (zh)
Other versions
CN106301747B (en
Inventor
陶成军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huzhou Yinglie Intellectual Property Operation Co ltd
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201610874496.4A priority Critical patent/CN106301747B/en
Publication of CN106301747A publication Critical patent/CN106301747A/en
Application granted granted Critical
Publication of CN106301747B publication Critical patent/CN106301747B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention belongs to router data simultaneous techniques field, it is specifically related to the realization method and system of bi-directional synchronization between a kind of router, implementation method comprises the following steps: add plug-in unit A and plug-in unit B in the web server of router R1, it is respectively configured to provide certification, produces key and support webdav agreement, web server also provides for UI end configuration listening port, there is provided and preserve config file, it is provided that the key of certification and account and can the config1 of synchronous directory;Router R2 provides UI end to set and accesses the URL request address that R1 provides, it is provided that the key obtained is registered in input on R1, it is provided that set catalogue config2 of R2 end monitoring, it is provided that the time point of synchronization is arranged;R2 provides monitored directory change and program p2 dealt with for change;P2 program is made up of multiple threads, and between multiple threads, coordinated completes the bi-directional synchronization of data between router.

Description

The realization method and system of bi-directional synchronization between a kind of router
Technical field
The invention belongs to router data simultaneous techniques field, be specifically related to the realization side of bi-directional synchronization between a kind of router Method and system.
Background technology
Along with developing rapidly of informationization technology, becoming increasingly popular of IT application in enterprise, all departments of enterprise build one after another The information system of oneself.But IT application in enterprises is a process progressively built, starts from informatization in the world and compare From the point of view of the experience of country early, informatization does not settles at one go, but is progressively set up by incremental process Come.So, result in and also existed a lot of in same enterprise and run on different platforms, used different data bases, The heterogeneous system using different development technique and development language to develop, defines information island.Along with informatization Deepen continuously, integrate the data of multiple heterogeneous system, the application of integrated multiple heterogeneous systems, realize data share, eliminate The demand of the discordance of inter-system data is the strongest.Therefore, during collaborative work becomes Automated Technology in Office, one more Crucial and important technology.
The route of SOHO (Small Office Home Office) router, i.e. small office or family office Device, it is adaptable to the Internet shared access of ADSL, HFC or partial wideband, and simple route service and fire wall merit are provided Energy.SOHO as the inevitable outcome of information age, has traditional office incomparable as the inevitable outcome of information age, SOHO Motility, the advantage such as creativeness.Nowadays, many manufacturers are all specifically designed for SOHO and have developed the corresponding network equipment, to adapt to Building mininet and the demand of collineation axis access, soho router is one of them.Soho router is shared One of best solution that network connects, it has four big advantages: 1, need not safeguard, once configuration successful, the most again need not enter Line pipe is managed;2, stable;3, it is no longer necessary to computer as proxy server, can effectively save the energy, cut down expenses; 4, detail router additionally provides several Ethernet interface, can be used for being directly connected to computer.
It is two-way same that the Chinese invention patent of Application No. 201110271644.0 discloses a kind of client and server The method and system of step, described method includes that apps server termination receives the service request that application client sends After, service request is resolved;If described apps server end judges that an application client have modified an object Data after, then according to the information in the form of application client information and the information of the object of subscription thereof, search subscribe to The application client of this object, it is judged that if finding, then the data of this object amended are sent to respective application journey Sequence client, keeps the data syn-chronization of client and server.This invention can after object changes server end One time was sent to each client the data updated, and made the data syn-chronization effect of client and server obtain further Promote.When client the machine of delaying occurs, restarts or during power down, and the data of server end are likely to be synchronized to the most in time visitor On the end of family, and the data in transmitting are likely to lose.
The data base that the Chinese invention patent application of Application No. 201310416525.9 discloses a kind of active and standby plate is two-way Synchronous method, comprises the steps: that the data base of active and standby plate is backed up by time cycle according to presetting respectively, obtains correspondence Backup Data;Detect the running status of active and standby plate;If active and standby plate was all restarted, the data base of the most active and standby plate is standby by it respectively Number is according to carrying out data recovery.This invention also provides for the system of correspondence, can active and standby plate restart or abnormal delay machine time, it is ensured that active and standby Plate data base keeps synchronous regime.But data syn-chronization can only be carried out according to the default time cycle, but also need data Back up, add the complexity of data syn-chronization.
At present, between router, the most frequently used mode of setting up of relation is OSPF (Open Shortest Path First) association View, i.e. OSPF, is that a kind of Link State route selects agreement, between the all-router in routing domain Exchange information.Each router can be understood whole topology of networks and support various different authentication scheme, but below existing Not enough: one, to configure relative complex, owing to network area divides and the complexity of network attribute, need analysis of network person to have higher Network knowledge level could configure and manage ospf network;Two, the routing overhead ability of equalization more weak cause between router same Step is not mated.
Summary of the invention
For above-mentioned deficiency present in prior art, the present invention provides the implementation method of bi-directional synchronization between a kind of router And system.
In order to reach foregoing invention purpose, the present invention by the following technical solutions:
The implementation method of bi-directional synchronization between a kind of router, comprises the following steps:
S1, adds plug-in unit A and plug-in unit B, plug-in unit A and plug-in unit B in the web server of router R1 and is respectively configured to provide and recognizes Card, generation key and support webdav agreement, web server also provides for UI end configuration listening port, it is provided that preserve config literary composition Part, it is provided that the key of certification and account and can the config1 of synchronous directory;
S2, router R2 provide UI end to set and access the URL request address that router R1 provides, it is provided that input is at router The key that the upper registration of R1 obtains, it is provided that set catalogue config2 of router R2 end monitoring, it is provided that the time point of synchronization is arranged;
S3, router R2 provide monitored directory change and program p2 dealt with for change;
S4, router p2 program is made up of multiple threads, and between multiple threads, coordinated completes data between router Bi-directional synchronization.
Preferably, the file configuration of described config1 is: { " port ": "<listening port of configuration>", "<key>": { " User ": "<R2>", " syncFloder ": "<being supplied to the catalogue of R2>" }.
Preferably, the file configuration of described config2 is: " config ": { " serverURL ": " http: // The storage catalogue that xx.xx.xx.xx:port/<R1 provides>", " key ": "<xxxxxx>", " localFloder ": "/mnt/ The monitored directory that sda/<R2 provides>", " syncTime ": "<time point of synchronization>".
Preferably, the plurality of thread includes thread A, thread B and thread C, and thread A is for the change of monitored directory, line Journey B is for processing the event of monitoring, and whether thread C changes for the synchronous directory file of querying router R1, uses multithreading Can be to the process comprehensive monitoring of bi-directional synchronization between router and the event of process.
Preferably, the operating procedure of described program p2 is as follows:
Step one, program initialization, and read config2 file;
Step 2, carries out corresponding environment variable settings, thus performs thread A or thread B or thread C.
Preferably, the execution process of described thread A is as follows:
S1, thread A initialize;
S2, monitored directory;
S3, stores change events chained list;
S4, it is judged that whether chained list is by lock, if chained list is by lock, then waits lock release, carries out catalogue renewal after release; If chained list is not by lock, the most directly carry out catalogue renewal.
Preferably, the execution process of described thread B is as follows:
S1, thread B initialize;
S2, it is judged that lock in time, i.e. judges whether the time of router R1 and router R2 synchronizes, if time synchronized, then Go to judge that whether event chained list is by lock;If time irreversibility, show thread block, until the time period is correct, then go to sentence Whether disconnected event chained list is by lock;
S3, event chained list not by lock, then goes to judge whether thread C is synchronizing, no matter whether thread C is intended in synchronization Traversal chained list processes event successively.
Preferably, the execution process of described thread C is as follows:
S1, thread C initialize;
S2, it is judged that judge lock in time, i.e. judges whether the time of router R1 and router R2 synchronizes, if the time is same Step, then at interval of the synchronous directory of 5 seconds querying router R1, and whether the synchronous directory of router R1 changes in contrasting 5 seconds;If Time irreversibility, shows thread block, until the time period is correct, then at interval of the synchronous directory of 5 seconds querying router R1 and right In than 5 seconds, whether the synchronous directory of router R1 changes;
S3, if router R1 synchronous directory change, then judge thread B whether at local synchronization, if thread B is not in this locality Synchronize, then the file download updated by router R1 is to local;If thread B is at local synchronization, then wait that thread B synchronously completes.
Preferably, the structure of the storage event of described thread A is as follows:
Typedef struct action Event{
Char action[20];// file activities event
Char*oldName;// ancient deed name
Char*newName;// new filename
Char*oldFolder;// old catalogue
Char*nerFolder;// new directory
}
Event change is listed as follows
{ " modify ": "<file is modified>",
" addfile ": "<newly-increased file>",
" move ": "<mobile file>",
" rename ": "<file is renamed>",
" delete ": "<file is deleted>",
" dragfile ": "<file is dragged>",
}。
Present invention also offers the system of the implementation method of bi-directional synchronization between a kind of router, it includes router R1 and road By device R2, router R1 as active router, router R2 is as from router, and router R1 and R2 all supports to store to arrange, Router R1 includes web server and the interface of configuration access port;Router R1 provides registering functional, provides after supporting registration Unique certification key, it is simple to the certification of access device;Router R1 provides the support to webdav agreement;Router R1 provides The interface of configuration synchronous directory, router R2 provides the configuration interface of local synchronization catalogue, and router R2 provides monitoring local literary composition The program of part change;The action of router R2 offer process monitoring local file carries out the program responded;Router R2 provides and looks into Ask the program whether synchronous directory of router R1 changes.
The present invention compared with prior art, provides the benefit that: the implementation method of bi-directional synchronization and be between router of the present invention System achieves bi-directional synchronization between principal and subordinate's router, can realize the file-sharing between router, is different from Dropbox or computer is shared File, computer realize share, the most at least can not power-off, router then can be understood as off line, can effectively utilize road The resource of Internet is accessed, it is achieved between router, share file by device whole day.Additionally, this Two-way File is shared, Ke Yishi Networking in existing little scope, forms privately owned shared circle, it may be assumed that
1, the present invention can realize real-time synchronization resource between principal and subordinate's router.
2, the present invention can realize router off line and shares resource.
3, the present invention can realize sharing resource between the local networking of little scope.
Accompanying drawing explanation
Fig. 1 is the flow chart of program p2 between router of the present invention in the implementation method of bi-directional synchronization.
Fig. 2 is the flow chart of the thread A in present procedure p2.
Fig. 3 is the flow chart of the thread B in present procedure p2.
Fig. 4 is the flow chart of the thread C in present procedure p2.
Detailed description of the invention
Below by specific embodiment, technical scheme is further described explanation.
Term is explained
WEB server is referred to as WWW (WORLD WIDE WEB) server, and major function is to provide network information and browses clothes Business.WWW is the multimedia information inquiry instrument of Internet, is the service the most just grown up on Internet, is also to send out Open up the fastest and current widest service.Exactly because there being WWW instrument, Internet in recent years is just made to send out rapidly Open up, and number of users is skyrocketed through.Web server is the program that can provide document to the browser sending request.
The operation principle of Web server is the most uncomplicated, may be generally divided into following four steps: connection procedure, request process, Answering and closedown connect.Connection procedure is exactly a kind of connection set up between Web server and its browser. Checking whether connection procedure realizes, user can find and open this virtual file of socket, the foundation meaning of this file It is successfully established the step for of connection procedure.Request process is exactly that the browser of Web uses this file of socket to it Server and various request is proposed.Answering is exactly to use http protocol the request transmission come proposed in request process To the server of Web, and then implementing task process, the result then using http protocol that task is processed is transferred to the clear of Web Look at device, on the browser of Web, show the above-mentioned interface asked simultaneously.Closing connection is exactly when previous step-response After process completes, the process disconnected between Web server and its browser.The aforementioned four step ring of Web server Ring interlocks, is closely linked to, and logicality is stronger, can support multiple process, multiple thread and multiple process and multiple threads The technology mixed mutually.
Config file, preserves configuration information to client application and uses, and ordinary circumstance, an application program is only Have such file, before compiling, be called App.config, use Visual Studio compiling every time, all can Copy is to the generation catalogue of application program, and Rename is: application name .config.
Thread, sometimes referred to as Lightweight Process (Lightweight Process, LWP), is the minimum of program execution stream Unit.The thread of one standard is by Thread Id, current instruction pointer (PC), set of registers and storehouse composition.It addition, thread is An entity in process, the ultimate unit independently dispatched by system and assign, thread oneself does not have system resource, only gathers around There is any requisite resource that is in operation, but it can be complete with what other thread belonging to a process together shared that process had Portion's resource.One thread can create and cancel another thread, can concurrently perform between the multiple threads in same process. Due to the mutual restriction between thread, cause thread to be in operation and present discontinuity.Thread also have ready, block and run three Plant basic status.Thread is a single sequential control flow process in program.Run multiple thread complete in single program simultaneously Become different work, referred to as multithreading.
Webdav (Web-based distributed authoring and versioning) agreement is based on HTTP One communication protocol of 1.1, its technical specification is defined by IETF RFC 2518, and it with the addition of some extensions for HTTP 1.1, With the addition of some new methods beyond several HTTP standard method such as GET, POST, HEAD, make the application program can be directly to Web Server direct read/write, and support rewrite file locking (lock) and unlock (unlock), it is also possible to support the version control of file System.
The original intention of the present invention mainly realizes following demand: if there is a router in A area, have the function of storage;B Also there is a router in area, the same storage function that provides, the renewal of the store files of existing demand B zone controller or change Dynamic, can be uploaded in time on router A, vice versa, it is achieved the bi-directional synchronization between router.
Then needing to provide at least two routers to realize this demand, be deployed in A, B area respectively, A area is disposed Router is provided that the request path of server, it is provided that the authority upload, downloaded, it is provided that the certification that client accesses;B area Router provides the change function of monitoring storage device file, it is provided that upper transmitting file, the function of download file, it is provided that synchronous documents Time period arrange.
The implementation method of bi-directional synchronization between the router of the present embodiment, comprises the following steps:
S1, adds plug-in unit A and plug-in unit B, plug-in unit A and plug-in unit B in the web server of router R1 and is respectively configured to provide and recognizes Card, generation key and support webdav agreement, web server also provides for UI end configuration listening port, it is provided that preserve config literary composition Part, it is provided that the key of certification and account and can the file configuration of config1, config1 of synchronous directory be: { " port ": " < The listening port of configuration>", "<key>": { " user ": "<R2>", " syncFloder ": "<being supplied to the catalogue of R2>" } };
S2, router R2 provide UI end to set and access the URL request address that router R1 provides, it is provided that input is at router The key that the upper registration of R1 obtains, it is provided that set catalogue config2 of router R2 end monitoring, it is provided that the time point of synchronization is arranged, The file configuration of config2 is: { " config ": { " serverURL ": " http://xx.xx.xx.xx:port/ < R1 provides Store catalogue>", " key ": "<xxxxxx>", " localFloder ": " monitored directory that/mnt/sda/<R2 provides>", " SyncTime ": "<time point of synchronization>";
S3, router R2 provide monitored directory change and program p2 dealt with for change;
S4, router p2 program is made up of thread A, thread B and thread C, and between three threads, coordinated completes route The bi-directional synchronization of data between device;
As it is shown in figure 1, the operating procedure of program p2 is as follows:
Step one, program initialization, and read config2 file;
Step 2, carries out corresponding environment variable settings, thus performs thread A or thread B or thread C;
Thread A is for the change of monitored directory, as in figure 2 it is shown, the execution process of thread A is as follows:
S1, thread A initialize;
S2, monitored directory;
S3, stores change events chained list;
S4, it is judged that whether chained list is by lock, if chained list is by lock, then waits lock release, carries out catalogue renewal after release; If chained list is not by lock, the most directly carry out catalogue renewal.
Thread A, the structure storing event is as follows:
Typedef struct action Event{
Char action[20];// file activities event
Char*oldName;// ancient deed name
Char*newName;// new filename
Char*oldFolder;// old catalogue
Char*nerFolder;// new directory
}
Event change is listed as follows
{ " modify ": "<file is modified>",
" addfile ": "<newly-increased file>",
" move ": "<mobile file>",
" rename ": "<file is renamed>",
" delete ": "<file is deleted>",
" dragfile ": "<file is dragged>",
}。
Thread B is for processing the event of monitoring, as it is shown on figure 3, the execution process of thread B is as follows:
S1, thread B initialize;
S2, it is judged that lock in time, i.e. judges whether the time of router R1 and router R2 synchronizes, if time synchronized, then Go to judge that whether event chained list is by lock;If time irreversibility, show thread block, until the time period is correct, then go to sentence Whether disconnected event chained list is by lock;
S3, event chained list not by lock, then goes to judge whether thread C is synchronizing, no matter whether thread C is intended in synchronization Traversal chained list processes event successively.
Whether thread C changes for the synchronous directory file of querying router R1, as shown in Figure 4, and the execution process of thread C As follows:
S1, thread C initialize;
S2, it is judged that lock in time, i.e. judges whether the time of router R1 and router R2 synchronizes, if time synchronized, then At interval of the synchronous directory of 5 seconds querying router R1, and whether the synchronous directory of router R1 changes in contrasting 5 seconds;If the time Asynchronous, show thread block, until the time period is correct, then at interval of the synchronous directory of 5 seconds querying router R1, and contrast 5 In second, whether the synchronous directory of router R1 changes;
S3, if router R1 synchronous directory change, then judge thread B whether at local synchronization, if thread B is not in this locality Synchronize, then the file download updated by router R1 is to local;If thread B is at local synchronization, then wait that thread B synchronously completes.
The preferred embodiment of the present invention additionally provides the system of the implementation method of bi-directional synchronization between a kind of router, and it includes road By device R1 and router R2, router R1 as active router, router R2 is as from router, and router R1 and R2 all supports Storing and arrange, router R1 includes web server and the interface of configuration access port;Router R1 provides registering functional, supports Unique certification key is provided, it is simple to the certification of access device after registration;Router R1 provides the support to webdav agreement;Road Thered is provided the interface of configuration synchronous directory by device R1, router R2 provides the configuration interface of local synchronization catalogue, and router R2 provides The program of monitoring local file change;The action of router R2 offer process monitoring local file carries out the program responded;Route Device R2 provides the program whether synchronous directory of querying router R1 changes.
Between router of the present invention, the realization method and system of bi-directional synchronization achieves bi-directional synchronization, energy between principal and subordinate's router Realizing the file-sharing between router, be different from Dropbox or computer Shared Folders, computer realizes sharing, and the most at least can not break Electricity, router then can be understood as off line, can effectively utilize router whole day to access the resource of Internet, it is achieved road By sharing file between device.
This kind of Two-way File that the present invention uses is shared, it is possible to achieve the networking in little scope, forms privately owned shared circle.
Below in conjunction with concrete real case, the implementation method of bi-directional synchronization between the router of the present invention is described further.
The striking news router selecting model to be FWR626 is active router, and model is that NETGEAR WNDR3700 router is From router, two-way synchronization method between the two comprises the following steps:
One, in the web server of the striking news router of FWR626, add plug-in unit A and plug-in unit B, plug-in unit A to recognize for offer Demonstrate, proving and produce password, plug-in unit B to be used for supporting webdav agreement, web server configures listening port at user interface UI end Web server provide preserve config file, it is provided that the password of certification and account and can synchronous directory config1 literary composition Part, the file configuration of config1 is:{ " port ": "<the listening port &gt of configuration; ", "<password>": { " user ": "<r2>", " syncFloder ": "<being supplied to the catalogue of NETGEAR WNDR3700>";
Two, the striking news router that NETGEAR WNDR3700 router provides user interface UI end to set access FWR626 carries The URL request address of confession, it is provided that input registers, on the striking news router of FWR626d, the password obtained, it is provided that set The catalogue config2 file of NETGEAR WNDR3700 router side monitoring, it is provided that the time point of synchronization is arranged, config2's File configuration is: { the striking news route of " config ": { " serverURL ": " http: // 192.168.1.1:port/ < FWR626d The storage catalogue that device provides>", " key ": "<password>", " localFloder ": "/mnt/sda/<NETGEAR The monitored directory that WNDR3700 router provides>", " syncTime ": "<time point of synchronization>";
Three, NETGEAR WNDR3700 router provides monitored directory change and program p2 dealt with for change, p2 Program is made up of thread A, thread B and thread C, and thread A is for the change of monitored directory, and the execution process of thread A is as follows:
S1, thread A initialize;
S2, monitors configuration file catalogue;
S3, stores configuration file and updates chained list;
S4, it is judged that whether chained list is by lock, if chained list is by lock, then waits lock release, carries out catalogue renewal after release; If chained list is not by lock, the most directly carry out catalogue renewal.
The structure of the storage event of thread A is as follows:
Typedef struct action Event{
Char action[20];//configuration files update
Char*oldName;//config.ini
Char*newName;//new config.ini
Char*oldFolder;//common
Char*nerFolder;//common
}
Event change is listed as follows:
{ " modify ": "<config.ini is revised as new config.ini>",
" rename ": "<config.ini named new config.ini>",
}。
Thread B is for processing the renewal of configuration file, and the execution process of thread B is as follows:
S1, thread B initialize;
S2, it is judged that lock in time, i.e. judge the striking news router of FWR626 and NETGEAR WNDR3700 router time Between whether synchronize, if time synchronized, then go to judge that whether file updates chained list by lock;If time irreversibility, show thread Block, until the time period is correct, then go to judge that whether file updates chained list by lock;
S3, file renewal chained list not by lock, then goes to judge whether thread C is synchronizing, no matter whether thread C is synchronizing It is intended to travel through chained list and carries out the renewal of file successively.
Whether thread C changes for the synchronous directory file of the striking news router of querying router FWR626, and thread C holds Row process is as follows:
S1, thread C initialize;
S2, it is judged that lock in time, i.e. judge the striking news router of FWR626 and NETGEAR WNDR3700 router time Between whether synchronize, if time synchronized, then at interval of the synchronous directory of striking news router of 5 seconds inquiry FWR626, and contrast in 5 seconds Whether the synchronous directory of the striking news router of FWR626 changes;If time irreversibility, show thread block, until the time period is just Really, then at interval of the synchronous directory of striking news router of 5 seconds inquiry FWR626, and the striking news router of FWR626 in contrasting 5 seconds Synchronous directory whether change;
S3, if the striking news router of FWR626 synchronous directory change, then judge thread B whether at local synchronization, if line Journey B is not at local synchronization, then the file download updated by the striking news router of FWR626 is to local;If thread B is at local synchronization, Then wait that thread B synchronously completes.
Above three thread is according to corresponding environment variable settings, in turn, using the striking news router of FWR626 as from Router, and NETGEAR WNDR3700 router is as active router, completes route by coordinated between three threads The bi-directional synchronization of configuration file more new data between device.
Above the preferred embodiments of the present invention and principle are described in detail, to those of ordinary skill in the art Speech, the thought provided according to the present invention, detailed description of the invention will change, and these changes also should be regarded as the present invention Protection domain.

Claims (10)

1. the implementation method of bi-directional synchronization between a router, it is characterised in that comprise the following steps:
S1, in the web server of router R1 add plug-in unit A and plug-in unit B, plug-in unit A and plug-in unit B be respectively configured to provide certification, Producing key and support webdav agreement, web server also provides for UI end configuration listening port, it is provided that preserves config file, carries For the key of certification and account and can the config1 of synchronous directory;
S2, router R2 provide UI end to set and access the URL request address that router R1 provides, it is provided that input is on router R1 The key that registration obtains, it is provided that set catalogue config2 of router R2 end monitoring, it is provided that the time point of synchronization is arranged;
S3, router R2 provide monitored directory change and program p2 dealt with for change;
S4, router p2 program is made up of multiple threads, and between multiple threads, coordinated completes the two-way of data between router Synchronize.
The implementation method of bi-directional synchronization between router the most according to claim 1, it is characterised in that described config1's File configuration is: { " port ": "<listening port of configuration>", "<key>": " user ": "<R2>", " syncFloder ": "< It is supplied to the catalogue of R2 > " } }.
The implementation method of bi-directional synchronization between router the most according to claim 1, it is characterised in that described config2's File configuration is: { " config ": the storage catalogue that { " serverURL ": " http://xx.xx.xx.xx:port/ < R1 provides >", " key ": "<xxxxxx>", " localFloder ": " monitored directory that/mnt/sda/<R2 provides>", " syncTime ": "< The time point synchronized > " } }.
The implementation method of bi-directional synchronization between router the most according to claim 1, it is characterised in that the plurality of thread bag Vinculum journey A, thread B and thread C, thread A is for the change of monitored directory, and thread B is for processing the event of monitoring, and thread C uses Whether the synchronous directory file in querying router R1 changes.
The implementation method of bi-directional synchronization between router the most according to claim 1, it is characterised in that the fortune of described program p2 Row step is as follows:
Step one, program initialization, and read config2 file;
Step 2, carries out corresponding environment variable settings, thus performs thread A or thread B or thread C.
The implementation method of bi-directional synchronization between router the most according to claim 5, it is characterised in that described thread A holds Row process is as follows:
S1, thread A initialize;
S2, monitored directory;
S3, stores change events chained list;
S4, it is judged that whether chained list is by lock, if chained list is by lock, then waits lock release, carries out catalogue renewal after release;If chain Table, not by lock, the most directly carries out catalogue renewal.
The implementation method of bi-directional synchronization between router the most according to claim 5, it is characterised in that described thread B holds Row process is as follows:
S1, thread B initialize;
S2, it is judged that lock in time, i.e. judges whether the time of router R1 and router R2 synchronizes, if time synchronized, then goes to Judge that whether event chained list is by lock;If time irreversibility, show thread block, until the time period is correct, then go to judge thing Whether part chained list is by lock;
S3, event chained list not by lock, then goes to judge whether thread C is synchronizing, no matter whether thread C is intended to traversal in synchronization Chained list processes event successively.
The implementation method of bi-directional synchronization between router the most according to claim 5, it is characterised in that described thread C holds Row process is as follows:
S1, thread C initialize;
S2, it is judged that judge lock in time, i.e. judges whether the time of router R1 and router R2 synchronizes, if time synchronized, then At interval of the synchronous directory of 5 seconds querying router R1, and whether the synchronous directory of router R1 changes in contrasting 5 seconds;If the time Asynchronous, show thread block, until the time period is correct, then at interval of the synchronous directory of 5 seconds querying router R1, and contrast 5 In second, whether the synchronous directory of router R1 changes;
S3, if the synchronous directory change of router R1, then judge thread B whether at local synchronization, if thread B is in this locality not together Step, then the file download updated by router R1 is to local;If thread B is at local synchronization, then wait that thread B synchronously completes.
9. according to the implementation method of bi-directional synchronization between the router of described in claim 5 or 6, it is characterised in that described thread A's The structure of storage event is as follows:
Typedef struct actionEvent{
Char action[20];// file activities event
Char*oldName;// ancient deed name
Char*newName;// new filename
Char*oldFolder;// old catalogue
Char*nerFolder;// new directory
}
Event change is listed as follows
{ " modify ": "<file is modified>",
" addfile ": "<newly-increased file>",
" move ": "<mobile file>",
" rename ": "<file is renamed>",
" delete ": "<file is deleted>",
" dragfile ": "<file is dragged>",
}。
10., based on the system of the implementation method of bi-directional synchronization between the router described in any one of claim 1-9, its feature exists In, including router R1 and router R2, router R1 as active router, router R2 is as from router, router R1 All supporting to store with R2 to arrange, router R1 includes web server and the interface of configuration access port;Router R1 provides registration Function, provides unique certification key after supporting registration, it is simple to the certification of access device;Router R1 provides webdav agreement Support;Router R1 provides the interface of configuration synchronous directory, and router R2 provides the configuration interface of local synchronization catalogue, route Device R2 provides the program of monitoring local file change;The action of router R2 offer process monitoring local file carries out the journey responded Sequence;Router R2 provides the program whether synchronous directory of querying router R1 changes.
CN201610874496.4A 2016-09-30 2016-09-30 The realization method and system of bi-directional synchronization between a kind of router Active CN106301747B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610874496.4A CN106301747B (en) 2016-09-30 2016-09-30 The realization method and system of bi-directional synchronization between a kind of router

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610874496.4A CN106301747B (en) 2016-09-30 2016-09-30 The realization method and system of bi-directional synchronization between a kind of router

Publications (2)

Publication Number Publication Date
CN106301747A true CN106301747A (en) 2017-01-04
CN106301747B CN106301747B (en) 2019-11-29

Family

ID=57717352

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610874496.4A Active CN106301747B (en) 2016-09-30 2016-09-30 The realization method and system of bi-directional synchronization between a kind of router

Country Status (1)

Country Link
CN (1) CN106301747B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446170A (en) * 2018-09-13 2019-03-08 北京米文动力科技有限公司 A kind of profile data synchronous method and equipment
CN111291011A (en) * 2020-02-19 2020-06-16 北京百度网讯科技有限公司 File synchronization method and device, electronic equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739706A (en) * 2011-04-07 2012-10-17 腾讯科技(深圳)有限公司 Method and system for carrying out data synchronization
CN105306581A (en) * 2015-11-11 2016-02-03 上海斐讯数据通信技术有限公司 Router and cloud disk based data synchronization method
CN105392140A (en) * 2015-11-19 2016-03-09 上海斐讯数据通信技术有限公司 Key configuration automatic synchronization method among wireless routers
CN106452717A (en) * 2016-09-14 2017-02-22 上海斐讯数据通信技术有限公司 Multi-router one-way synchronization method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739706A (en) * 2011-04-07 2012-10-17 腾讯科技(深圳)有限公司 Method and system for carrying out data synchronization
CN105306581A (en) * 2015-11-11 2016-02-03 上海斐讯数据通信技术有限公司 Router and cloud disk based data synchronization method
CN105392140A (en) * 2015-11-19 2016-03-09 上海斐讯数据通信技术有限公司 Key configuration automatic synchronization method among wireless routers
CN106452717A (en) * 2016-09-14 2017-02-22 上海斐讯数据通信技术有限公司 Multi-router one-way synchronization method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446170A (en) * 2018-09-13 2019-03-08 北京米文动力科技有限公司 A kind of profile data synchronous method and equipment
CN109446170B (en) * 2018-09-13 2024-01-19 北京米文动力科技有限公司 Configuration file data synchronization method and device
CN111291011A (en) * 2020-02-19 2020-06-16 北京百度网讯科技有限公司 File synchronization method and device, electronic equipment and readable storage medium
CN111291011B (en) * 2020-02-19 2023-10-20 北京百度网讯科技有限公司 File synchronization method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN106301747B (en) 2019-11-29

Similar Documents

Publication Publication Date Title
US10873570B2 (en) System and method for efficient replication of and access to application specific environments and data
CN107667517B (en) Implanted agent within a first service container for enabling reverse proxy on a second container
US8108548B2 (en) Methodology and system for file replication based on a peergroup
JP5456677B2 (en) Web service endpoint synchronization in a multi-master synchronization environment
CN109104318A (en) The dispositions method and system of method for realizing cluster self-adaption deployment, the self-adaption deployment big data cluster based on cloud platform
US20050086384A1 (en) System and method for replicating, integrating and synchronizing distributed information
WO2013102253A1 (en) System and method for providing p2p based reconfigurable computing and structured data distribution
KR20090078721A (en) Upnp ras apparatus for supporting multiple remote access and method thereof
EP2636199A1 (en) Signalling gateway, method, computer program and computer program product for communication between http and sip
Sathiaseelan et al. Scandex: Service centric networking for challenged decentralised networks
Afanasyev et al. The story of chronoshare, or how ndn brought distributed secure file sharing back
CN103036934A (en) Wide area network clustered deployment system and method based on mirror image
CN106301747A (en) The realization method and system of bi-directional synchronization between a kind of router
Kim et al. K-GENI testbed deployment and federated meta operations experiment over GENI and KREONET
US20240097979A1 (en) Fabric availability and synchronization
Moeyersons et al. Pluggable SDN framework for managing heterogeneous SDN networks
Borch Social peer-to-peer for social people
Herry et al. Peer-to-peer secure updates for heterogeneous edge devices
van der Linde Enriching Web Applications with Browser-to-Browser Communication
US20230216861A1 (en) System And Method For Efficient Replication Of And Access To Application Specific Environments And Data
US11218540B1 (en) System and method for efficient replication of and access to application specific environments and data
de Jong et al. Sharing digital object across data infrastructures using Named Data Networking (NDN)
Wang et al. Design and Research of SDN Unified Controller in Large Data Center
Guetmi et al. Cloud patterns for mobile collaborative applications
Shang Distributed Dataset Synchronization in Named Data Networking

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201119

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201216

Address after: 8319 Yanshan Road, Bengbu City, Anhui Province

Patentee after: Bengbu Lichao Information Technology Co.,Ltd.

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210310

Address after: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: 8319 Yanshan Road, Bengbu City, Anhui Province

Patentee before: Bengbu Lichao Information Technology Co.,Ltd.

PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method and system of bidirectional synchronization between routers

Effective date of registration: 20221204

Granted publication date: 20191129

Pledgee: Huzhou Wuxing Rural Commercial Bank Co.,Ltd. high tech Zone Green sub branch

Pledgor: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Registration number: Y2022330003403

PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20231205

Granted publication date: 20191129

Pledgee: Huzhou Wuxing Rural Commercial Bank Co.,Ltd. high tech Zone Green sub branch

Pledgor: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Registration number: Y2022330003403