Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

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

1 solution

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
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900