Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread Language
Sponsored Links
Old 08-06-2008, 01:47 PM   #1
 
PiqueABoo's Avatar
 
Join Date: Jan 2006
Posts: 498
Thanks: 1
Thanked 20 Times in 16 Posts
Rep Power: 9 PiqueABoo will become famous soon enoughPiqueABoo will become famous soon enough
Default 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.
  Reply With Quote
Old 08-06-2008, 05:28 PM   #2
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,875
uk uk lancashire
Thanks: 42
Thanked 223 Times in 203 Posts
Blog Entries: 1
Rep Power: 66 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default

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.
  Reply With Quote
Old 08-06-2008, 07:32 PM   #3
 
PiqueABoo's Avatar
 
Join Date: Jan 2006
Posts: 498
Thanks: 1
Thanked 20 Times in 16 Posts
Rep Power: 9 PiqueABoo will become famous soon enoughPiqueABoo will become famous soon enough
Default

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.
  Reply With Quote
Old 16-06-2008, 08:46 PM   #4
 
monkeyx's Avatar
 
Join Date: Nov 2006
Posts: 181
Thanks: 3
Thanked 13 Times in 11 Posts
Rep Power: 7 monkeyx will become famous soon enough
Default

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.
  Reply With Quote
Old 16-06-2008, 11:49 PM   #5
 
PiqueABoo's Avatar
 
Join Date: Jan 2006
Posts: 498
Thanks: 1
Thanked 20 Times in 16 Posts
Rep Power: 9 PiqueABoo will become famous soon enoughPiqueABoo will become famous soon enough
Default

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)

Quote:
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.
  Reply With Quote
Reply

Register now for FREE and post messages!


Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Birthday:      
Image Verification
  I agree to forum rules 

Similar Threads
Thread Thread Starter Forum Replies Last Post
BAD dotNet docs PiqueABoo Coding 1 10-11-2007 03:54 PM
DNS Queries excessive ? Scruff Networks 12 16-10-2007 06:08 PM
DNS reverse look up zones. Kyle Windows 1 16-10-2007 08:42 AM
One||Zero queries Gatt Windows 18 23-05-2006 02:23 PM
ISA Queries... Gatt Windows 14 11-05-2006 06:42 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 03:09 AM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright EduGeek.net