有没有办法在c#上监视系统的DNS缓存? [英] Is there a way to monitor the system's DNS cache on c#?
问题描述
我想用c#对系统的DNS缓存请求进行实时监控.我的系统是Windows 7 64位.到目前为止,我所做的是通过在端口53上创建一个侦听UDP服务器来捕获DNS请求,但这将监视所有DNS请求,我感兴趣的仅是对本地OS的DNS缓存的请求.有没有办法监视系统的DNS缓存?THx
I want to do a real time monitor of the DNS cache requests of the system in c#. My system is a windows 7 64 bit. What I did so far is to catch the DNS requests by creating a listening UDP server on port 53, but this monitors ALL the DNS request, what I am interested in are only request made to DNS cache of the local OS. Is there a way to monitor the DNS cache of the system? THx
推荐答案
You can get your DNS cache via this powershell function: Show-DnsServerCache
此 SO帖子说明了如何从C#调用powershell函数.
And this SO post illustrates how to call powershell functions from C#.
这篇关于有没有办法在c#上监视系统的DNS缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!