mikescham
September 5th, 2002, 08:00 PM
I'm looking for a way to find the default dns ip for the computer that is executing my app. I have yet to find a definitive way to do this. I saw something about using a registry key but I don't know how this will fare in a dhcp network. I've also seen some c++ source that uses a broadcast to send a dns query out to the local network but I'm not 100% clear on how commonly broadcasts are supported. I'm considering querying one of the root servers with a pointer query on the local machine's ip and pulling a dns ip from the resource records returned but neither that or the broadcast method will give me the actual default dns set up on the local computer since a user can specify whatever dns server they like. And I don't know if a root server will honor a request from any old program.
Anybody know how the .net DNS class does this?
I'm trying to write my own DNS client. Watching the .net Dns class with my packet sniffer shows that it will issue a common udp dns query and if that fails it will send a netbios query. On my network the netbios query is answered with a icmp destination unreachable error which lead me to a lot of extra coding for my application which relies on icmp responses. That was probably a good thing but... now I'm all keyed up on writing my own dns client. Any help would be greatly appreciated.
Anybody know how the .net DNS class does this?
I'm trying to write my own DNS client. Watching the .net Dns class with my packet sniffer shows that it will issue a common udp dns query and if that fails it will send a netbios query. On my network the netbios query is answered with a icmp destination unreachable error which lead me to a lot of extra coding for my application which relies on icmp responses. That was probably a good thing but... now I'm all keyed up on writing my own dns client. Any help would be greatly appreciated.