473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

System.Net.Dns.Resolve issue

Hi All,

This is a cut down version of a post from earlier entitled "Name resolution
in .Net". Apologies, for the repeat, but I think the first post was too
verbose (it came from a blog article of mine) and I think a shorter post
here is probably more appropriate.

I am seeing some incorrect behaviour on System.Net.Dns.Resolve( hostname )
It would appear that this does more than just a DNS lookup (which is what it
says in the documentation), at least when resolving the address of the
local machine.

I have a server with two NICs and hence two IP addresses: 10.0.0.5 and
192.168.0.2. Only the latter of these has a DNS entry (mapping to the host
name 'terminus'). The former IP address is not listed anywhere (DNS or hosts
file).
If I call System.Net.Dns.Resolve( 'terminus') from the server itself, I get
both IP addresses coming back. How is this possible if the call is only
doing a DNS lookup? A test with nslookup verifies that the name 'terminus'
has a single A record only, pointing to 192.168.0.2.

My suspision is that this call is also checking the NetBIOS name cache;
"netstat -a terminus" lists the same results as the resolve call. If so,
this is not what the documentation says it does.

Any ideas anyone ?
Is it possible to do a DNS lookup ONLY on a hostname ?

Thanks in advance for any help,

Rob Levine
http://roblevine.blogspot.com
Nov 16 '05 #1
2 6122
Rob Levine wrote:
Hi All,

This is a cut down version of a post from earlier entitled "Name resolution
in .Net". Apologies, for the repeat, but I think the first post was too
verbose (it came from a blog article of mine) and I think a shorter post
here is probably more appropriate.

I am seeing some incorrect behaviour on System.Net.Dns.Resolve( hostname )
It would appear that this does more than just a DNS lookup (which is what it
says in the documentation), at least when resolving the address of the
local machine.

I have a server with two NICs and hence two IP addresses: 10.0.0.5 and
192.168.0.2. Only the latter of these has a DNS entry (mapping to the host
name 'terminus'). The former IP address is not listed anywhere (DNS or hosts
file).
If I call System.Net.Dns.Resolve( 'terminus') from the server itself, I get
both IP addresses coming back. How is this possible if the call is only
doing a DNS lookup? A test with nslookup verifies that the name 'terminus'
has a single A record only, pointing to 192.168.0.2.

My suspision is that this call is also checking the NetBIOS name cache;
"netstat -a terminus" lists the same results as the resolve call. If so,
this is not what the documentation says it does.

Any ideas anyone ?
Is it possible to do a DNS lookup ONLY on a hostname ?

Thanks in advance for any help,

Rob Levine
http://roblevine.blogspot.com


Hi,

maybe no dns lookup is being done at all, as the name matches the one of
the local machine (supposing no two machines can have the same name).
Can you verify that ? What happens if the app is run from another machine ?

Cheers,
Benoit
Nov 16 '05 #2
>
Hi,

maybe no dns lookup is being done at all, as the name matches the one of
the local machine (supposing no two machines can have the same name). Can
you verify that ? What happens if the app is run from another machine ?

Cheers,
Benoit


Hi Benoit,

I suspect you are correct. If I do the same method call from another machine
I only get one IP address back, the one from the DNS.
This leaves me with a problem though; how can I do a DNS lookup for a given
A record for a host (as if I was using something like nslookup) from the
host itself?
There would appear to be no way of doing this within .Net; short of writing
a proper DNS client (or obtaining a 3rd party one).

Any ideas?

It would be helpful if the documentation wasn't so misleading on the nature
of this method call.

Thanks for your hewlp,

Rob

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RitaG | last post by:
Hi. I know you can send an email using System.Web.Mail but other than using the Outlook object, is there another way to read the email in an Inbox. I'm currently reading the mail in an Inbox...
6
by: Markus Wildgruber | last post by:
Hi! How can I get information about the system my application is running on? I found the System.Environment class that provides me with some of the desired information but some of them not in...
8
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's...
3
by: Karl Hungus | last post by:
A cs file I compiled into an assembly dll is in my bin directory. In the cs file I have a using statement for System.Xml I compiled it using this command: csc /out:XmlContent.dll /t:library...
0
by: Raja B | last post by:
I start getting this exception when I moved my windows service to a Windows 2003 (32 bit running on AMD Opteron processors) server with ..NET framework 2.0 . The EventLog says Event Type: ...
0
by: Neha | last post by:
When I run my test cases I gets the following error: Warning: Test Run deployment issue: The assembly or module 'System.Xml' directly or indirectly referenced by test assembly "path" was not...
3
by: NickP | last post by:
Hi there, Today I try to compile an application of mine and I am getting a whole list of bizaar errors.... ------------------------------------------------ Error 1 The...
5
by: =?Utf-8?B?cnZhbmdlbGRyb3A=?= | last post by:
Hello, I have a problem with our OnlineBackupService.exe. This is a Windows Service which is built in .Net 1.1 and basically grabs files from the file system and will try to upload them using...
5
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a .Net web service that converts the MODCA files to tif or png file format. This web service runs on a 2003 server. This web service first copies the MODCA file to be converted to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.