问题描述
东西令我着迷,我不觉得有这方面的资源。
如何FileSystemWatcher的知道,当一台计算机上的文件A创建/删除/修改/重命名?
我认为这曾与投票,(观察员轮询服务器以检查更新),但验证与Wireshark的网络活动后,我看到的是不使用轮询。是否SMB协议使用一个可观察/观察者模式?
在这种情况下,服务器如何知道什么时候客户端不遵守他了?
什么后果时,该网络在观察和瀑布后面紧接着来?
在另一台计算机使用FileSystemWatcher的似乎太容易是真实的......
这有点是。底层API - ReadDirectoryChanges()
- 开辟了服务器,它负责响应时有变化的连接。如果该连接被出于某种原因掉线,或者你碰到反对你连接到OS的连接数限制,那么你没有得到通知。
我发现,它更可靠,定期轮询(有一些相当长的时间),并使用 FileSystemWatcher的
只是作为快速响应变化之间的一种方式民意调查。
Something intrigues me and I don't find any resource on this.
How can FileSystemWatcher know when a file on a computer "A" is created/removed/changed/renamed ?
I thought that this worked with polling, (the observer polls the server to check update), but after verifying the network activity with Wireshark I saw that polling was not used.Does the SMB protocol use a observable/observer pattern ?
In this case how the server can know when a client doesn't observe him anymore ?
What is the consequence when the network falls during an observation and comes back right after?
Using FileSystemWatcher on another computer seems too easy to be true...
It kinda is. The underlying API - ReadDirectoryChanges()
- opens up a connection to the server, which is responsible for responding when something changes. If that connection gets dropped for some reason, or you bump up against the connection limit of the OS you're connecting to, then you don't get notifications.
I've found that it is more reliable to poll periodically (with some rather long interval), and use FileSystemWatcher
only as a way of responding quickly to changes in between polls.
这篇关于如何FileSystemWatcher的在另一台计算机目录工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!