如何看一个文件系统的变化文件系统、如何看

2023-09-05 02:58:42 作者:情到浓时终转薄

我做的一门课程的一个项目,在我的分布式系统上大学。我打算建立类似Dropbox的(getdropbox.com)的东西,但也有一些种类的非集中式的对等的转折吧。为此,我需要在目录结构中检测变化的一些方法。您如何看待Dropbox的做到这一点?它们的实施​​工作非常好。我很奇怪,如果他们使用FileSystemWatcher的从Win32 API的窗户,以及类似的东西,平台依赖于Linux和Mac。

I'm doing a project in a course at my university on distributed systems. I'm planning on creating something similar to Dropbox ( getdropbox.com ), but with some sort of non-centralized peer-to-peer twist to it. For this i need some method of detecting change in a directory structure. How do you think Dropbox do this? Their implementation works remarkably well. I'm wonder if they use FileSystemWatcher from the win32 api on windows, and something similar and platform dependent on Linux and Mac.

推荐答案

据我所知,投放箱(之类的),使用Windows服务(或在Linux / Mac上一侧的后台程序)来监视文件系统。在.net中建立这样是很容易的,这种情况下通常是典型例子为Windows服务。我相信,在做C ++类似的事情将是相当简单的为好。

To my knowledge, DropBox (and the like) uses a Windows service (or a daemon on the Linux/Mac side) to monitor the file system. Creating such in .Net is very easy and this scenario is usually the textbook example for Windows Services. I believe doing a similar thing in C++ would be fairly straight forward as well.

下面是关于如何在Windows创建一个服务链接到一个简单的教程.NET。所有你需要为你的解决方案是在Timer.Tick()事件添加监视逻辑。

Here's a link to a simple tutorial for .Net on how to create a service on Windows. All that you would need to do for your solution is add your monitor logic in the Timer.Tick() event.

http://www.developer.com/net/csharp/article。 PHP / 2173801