Click here to Skip to main content
13,191,400 members (80,243 online)
Rate this:
Please Sign up or sign in to vote.

I am trying to develop an application to synchronize two directories of the two live domains hosted over different servers but i am not getting the logic to implement.
I have tried it to do with tcp client server on localhost using different applications on different ports, but its not working properly, whenever i tried to write network stream remote host server crashed.

Kindly please help me ...
Posted 3-Apr-13 7:08am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi there,

You need to look into 'FTP'.

The conventional web we browse is based on 'HTTP' is designed for viewing text, images, etc. but not for file transfer. 'FTP' is designed this in mind and if you can access your server using FTP you should be able to do most of the operations that you are trying to achieve.

FtpWebRequest Class[^]
This class is a wrapper for FTP which is built-in to C#. It should help you. If it doesn't, well, try the code FTP commands and try playing around with them.

Hope this helps, Regards
Ariana Bond 4-Apr-13 19:39pm
But as i totally want to do this by without using FTP that is why i have posted here else if i want to do it by FTP , Code is available on number of Portals, So please, if you can help me with my situation , I'l be very thankful to you..
CodeHawkz 5-Apr-13 0:09am
Well, you should have mentioned so in your question, don't you think? :)
Anyways, there is nothing called cannot do. So I'd tell you the solution that comes off the top of my mind.

Normally, the user you use to run your website as is not given 'write' permissions. For obvious and potential security reasons. So security aspect of this, I'd leave it to you, should you choose to implement it.

All you have to do is, create two web pages, or a web service with two method calls for this matter. One method/page should allow, you to get the list of files/directories (say an array of file names and sizes) in a certain location and the other method should allow you to upload a file and save it to the location you pass along.

You haven't mentioned whether this synchronization is one way or two way and how the synchronization is triggered. But regardless, with the usage of these 2 functionality you should be able to compare the list of files/folders and sync where necessary. It may be a scheduled task or it may be done upon a request to another web-service; I'd leave the implementation details for you.

Lastly, for this to work, you should allow the user with whom you are running on localhost, the privileges to write to folders. My last advice is security, security, security, security. Because, if you leave this unprotected in any sort, you won't have much left :)

Hope this helps, regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171017.1 | Last Updated 4 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100