Solved

File Replication

Posted on 2001-06-14
6
250 Views
Last Modified: 2013-11-13
Basically guys Im after some pointers in the right direction here.....

I have been asked to write an app that will replicate Word documents in various directories amongst 3 sites that belong to a branch.  So basically they want all three sites at some stage or another to have the same versions of files, when users update them.  

The plan is to have a client admin tool, where somebody can specify the directories (source and target) and the replication frequency. EG.

From: c:\windows
To:   I:\MainDataPool
Frequency:  Every 1/2 hour

We will then have a "watcher" server side util, that with the help of a few api's, will watch these directories, and build up up a log of which files change in these directories.

This Im okay with, but I thought you may need it for a full picture.

The problematic area is the "Replicator", which also needs to be a server side util, preferably running as a service.

This is where Im having problems trying to think of the best way to implement this.  As mentioned several directories will potentially have different replicating intervals, so i was thinking of having an apartment threaded util, that the watcher creates a thread for every time interval / directory.  But it gets a bit messy then in trying to keep track of which files need replicating as potential we have z files on x threads, which belong to which.  So I am a little confused.

Any pointers and / or psuedo code would be great.

If you need anymore info then shout.

PS.  Dont worry about two sites making changes to the same file at roughly the same time.  We've decided to put both files in a temp dir and send an email to a responsible person so they can sort out the mess!

Cheers guys,

Ray.
0
Comment
Question by:raybetts
6 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6193077
My first question is whether the replication is necessary...

* Is it for the purpose of creating redundancy to prevent loss of data?
* Is it because the competing systems are off-line from each other?

Why no just put the file on a central server for access to whomever gets it first.  If it's a Word doc, when another user goes to access it, Word will display a message and ask if you'd like to open it read-only.
0
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6193082
Hi,

Couldn't you just store all of the replication times' settings in one place, like a database or a file, then have the server service poll this file every 30 seconds or something to see if there is anything it needs to do. Also, rather than creating watched folders on all of the machines, why not have the central server store the last modified date of all of the files and then when a replication is scheduled, check the last modified date and replicate and update the central list if necessary.

Zaphod.
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 6193812
HI!

How about using this:

Download...
http://www.vb-helper.com/Howto/filesock.zip
Description: Transfer files from one computer to another using Winsock (8K)

And/OR this:


A+ Winsock Transfer *NEW* both in one form. App & Client - Easy. * A MUST HAVE*

Download...
http://www.planetsourcecode.com/upload/ftp/CODE_UPLOAD88188102000.zip
Description: This is a re-make of the code I posted yesterday. Now you it consists of only one form who is able to receive and send files. You can use it to provide your app with internal filetransfer or even chats. Please visit http://www.inter-dev.de for more! -------- Thats what I posted yesterday! " This code allows you to transfer files from one pc to another using winsock. Well it does not use only api declarations but it works. I comment it in english so i hope you can understand it because i'm german. I made that example because a lot of winsock transfer file toolkits are not precise enought. Some do not use send complete and some examples show you how your file become bigger and bigger after every transfer because they do not check the file size! I do not say that my one is perfect but much better than most of the others. For example I do not like the filesize check-routine... if you know a better way to fix that, please send me your ideas to manager@directbox.com. The "FILEINFO" routine should also made in a better way... you should take another winsock to transfer fileinfos. I also included the transfered bytes per second in that sample! "


ANd/OR this:

Donload...
http://www.planetsourcecode.com/upload/ftp/ActiveX%20Fi199575232001.zip
Description: Transfer files over a network. Set the packet size, cancel, shows rate of transfer. Problems threading it, if you can help on the multi-thread/transfer please do, and vote if you like =)
Rename the two included files, one is an exe, one is the ocx.

My point is:  Make your own server-client progam.  The clients will keep checking for files every minnute but the server will only send the files after 30 mins or whichever values of minutes you prefer.

That's it!

glass cookie : )
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Author Comment

by:raybetts
ID: 6198610
Guys thanks for the info.

Rapahitz:

Its not for data loss, its just so everyone has the use of the same version of files.

Yes having a central server would be nice, but our client has a pretty crap network infastructure, so only admin type cross network rotuines are allowed.

Z_Beeblebrox:

Nice idea, I will discuss this with my boss on monday.  Is this a programming solution or something I would set up in NT??????

Glass_Cookie:

thanks for the tonnes of info, will check your stuff out on monday.  I work away from home, so weekends are me and wife time!

Will see you guys through the week.

Ray.
0
 
LVL 7

Accepted Solution

by:
Z_Beeblebrox earned 200 total points
ID: 6198748
Hi,

My suggestion would require you to write a program which would run on a server somewhere (it could be one of the client computers) and manage all of the files. You shouldn't need any of glass_cookies' suggestions as long as you can map a network share to the various computers. If you can, then you can just do a file copy. Probably the easiest way to do this would be to write a little VB program which would run on start up on one of the computer and every 30 seconds or so would check a file which contained all of the various files to be replicated and where they should be replicated to, as well as that file's last modified date. It could then check each of the files' modified dates against the dates stored in that file and replicate where the dates are different.

You would probably also want to throw together a little client program which people could use to configure which files were to be replicated. This program could run on any computer and would modify the file on the server that does the replication.

Depending on how sophisticated you want this to be, you may want to consider using a database like Access to store all of the various settings.

Zaphod.
0
 
LVL 1

Author Comment

by:raybetts
ID: 6208119
Zaphod

Cheers,

It was also the idea I sort of came up with (honest!).  I just had brain blockage last week (thus the reason for throwing the problem to you guys), and thought the route i was going down was a dead end, but you confirmed that its the way you would tackle it.

So Ive just finished my client app, and over the next week should have my directory watcher in place and also the replicator.

Thanks to everyone else, I appreciate the effort you all put in....we all lead busy lives after all.

Adios,

Ray.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question