+ Post New Thread
Results 1 to 5 of 5
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 ...
  1. #1

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    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.

  2. #2

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    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.

  3. #3

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    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.

  4. #4
    monkeyx's Avatar
    Join Date
    Nov 2006
    Posts
    364
    Thank Post
    8
    Thanked 52 Times in 41 Posts
    Rep Power
    25
    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.

  5. #5

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    Quote Originally Posted by monkeyx View Post
    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:
+ Post New Thread

Similar Threads

  1. BAD dotNet docs
    By PiqueABoo in forum Coding
    Replies: 1
    Last Post: 10th November 2007, 02:54 PM
  2. DNS Queries excessive ?
    By Scruff in forum Wireless Networks
    Replies: 12
    Last Post: 16th October 2007, 06:08 PM
  3. DNS reverse look up zones.
    By Kyle in forum Windows
    Replies: 1
    Last Post: 16th October 2007, 08:42 AM
  4. One||Zero queries
    By Gatt in forum Windows
    Replies: 18
    Last Post: 23rd May 2006, 02:23 PM
  5. ISA Queries...
    By Gatt in forum Windows
    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
  •