有没有办法在c#上监视系统的DNS缓存? [英] Is there a way to monitor the system's DNS cache on c#?

查看:67
本文介绍了有没有办法在c#上监视系统的DNS缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用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

推荐答案

您可以通过以下Powershell函数获取DNS缓存:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆