Reputation: 34818
Is there a way in .NET (for a WPF application running on XP, Vista, or Windows 7) to monitor/sniff DNS lookups that the application is making to local DNS?
For example, is there a log file for a windows local DNS cache somewhere?
(Background - parsing network packets doesn't seem to work as a DNS lookup may not have to be issued outside of the PC if it is already cached in the Windows DNS)
Upvotes: 3
Views: 2863
Reputation: 13589
FWIW, checking tcpview+perfmon /res, it appears that dnscache listens on 'localhost' (for both ipv4 and ipv6 on my win7) on UDP port 5355, and since netmon can capture localhost traffic (most sniffers can't AFAIK), you should be able to use the NMAPI (look at Microsoft Network Monitor 3\api\NetmonAPI.cs after you install it) to monitor that traffic.
VRTA and NMExperts (IIRC) site on top of the managed interface if you want places to look for existing consumers for sample code:
Upvotes: 2