Coding Thread, dotNet: DNS PTR (reverse) queries in Coding and Web Development; Haven't done reverse DNS lookups on Windows for a long while and just found out the hard way that it ...
-
8th June 2008, 01:47 PM #1 dotNet: DNS PTR (reverse) queries
Haven't done reverse DNS lookups on Windows for a long while and just found out the hard way that it can be a pain with dotNet and the experience is worth writing down:
1) Use an older function like Resolve() and you get told it's 'obsolete' and you should use GetHostByAddress(). Do what you're told and you may well hit this problem: MS Connect link
2) Either way your code may end up hanging around a while if the IP isn't in DNS. Presumably it tries asking whatever is at that IP address for it's NetBIOS name, and if that box isn't switched on eventually gets around to timing out. YMMV but I didn't want the latter.
3) So I gave up and went and found a 3rd party DNS resolver dnDNS and so far that works just fine.
-
-
IDG Tech News
-
8th June 2008, 05:28 PM #2 I don't know anything about .net coding but over here in *nix land we generally try and do DNS resolution (in either direction) in it's own thread/process and use a named pipe/IPC/etc to tell the main program if/when we get an answer. That way we don't get in the way of the main processes execution path and hold everything up.
-
-
8th June 2008, 07:32 PM #3 Oh you do that everywhere when you need to, but in this case a) the DNS service running on the same box is authoritative for my queries, b) I only want an answer from DNS (and I want it to be correct!), c) there's not enough mileage in it to justify coding threads and locks etc.
-
-
16th June 2008, 08:46 PM #4 Thanks for DNS link, will have a look at that.
TO be honest I currently resolve IP address/host via a thread to stop really bad WMI timeouts by only trying to connect to a valid host that pings, as the WMI RPC timeout is V slow!
I take it you were using a try/catch on the ip lookup. They do sometimes seem to add a bit of lag to reponse times, when the catch fires! Been looking at ways of working around it, that avoid c++!
If anyone has info on this I would be grateful.
-
-
16th June 2008, 11:49 PM #5 
Originally Posted by
monkeyx
stop really bad WMI timeouts by only trying to connect to a valid host that pings, as the WMI RPC timeout is V slow!
Same principle here, but I usually send an ARP to the target IP to check for signs of life (which works nicely provided your targets are on the same subnet)
I take it you were using a try/catch on the ip lookup. They do sometimes seem to add a bit of lag to reponse times, when the catch fires! Been looking at ways of working around it, that avoid c++!
Have thrown the GetHostEntry/ByAddress code away now, but must have been catching. Didn't notice that lag but it's got to be teensy compared to an RPC timeout.
-
SHARE:
Similar Threads
-
By PiqueABoo in forum Coding
Replies: 1
Last Post: 10th November 2007, 03:54 PM
-
By Scruff in forum Networks
Replies: 12
Last Post: 16th October 2007, 06:08 PM
-
Replies: 1
Last Post: 16th October 2007, 08:42 AM
-
Replies: 18
Last Post: 23rd May 2006, 02:23 PM
-
Replies: 14
Last Post: 11th May 2006, 06:42 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules