473,395 Members | 1,456 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,395 software developers and data experts.

DNS.GetHostEntry()

Hi all,

I have a small "irritant" to do with DNS resolving in .NET Framework v2.0.

For this example, assume the following network information;
Local IP address is 192.168.0.10, on a PC named "PC_01"
Remote address is 192.168.0.20, on a local LAN, and named "PC_02"

DNS.GetHostByAddress("192.168.0.20").Hostname returns "PC_02"
DNS.Resolve("192.168.0.20").Hostname returns "PC_02"

Both these methods are marked obsolete in v2.0 of the framework, and
GetHostEntry is recommended as the replacement. However;

DNS.GetHostEntry("192.168.0.20").Hostname returns "192.168.0.20" .....
not the hostname!!

The only other thing I've noticed is that
DNS.GetHostEntry("192.168.0.10").Hostname returns "PC_01", so it seems to
work on the local node.

Anyone got any idea why!??! Or is it just an annoying bug in
GetHostEntry()?? :(
__________________________________
The Grim Reaper
Feb 6 '06 #1
2 5361
Try getting the Host entry using the host name... Dns.GetHostEntry
("PC_02"); and see if it returns the right IPAddress. If the IPAddress
returned is different then your DNS server is not mapping 192.168.0.20
as PC_02, or if an exception occurs then the DNS server cannot resolve
the address...

This is not a bug but a behaviour of how DNS lookups are done. IP
address that do not have related DNS records will be returned with the
host name as the ip address provided in the lookup.

Hope this helps...
- NuTcAsE

Feb 7 '06 #2
I'm afraid that doesn't help! DNS.GetHostEntry("PC_02") definitely returns
the correct IP (and yes, each PC has only one NIC and one IP).
There are no exceptions.
I don't actually know that much about DNS server activity in XP Pro
(although I should! :S)...
Pinging PC_02 returns the text "Pinging PC_02 [192.168.0.20] ...." etc.
I'm pretty sure the network/DNS config is fine.. because as I originally
mentioned, GetHostByAddress() works fine - it's just marked as obsolete in
Framework v2.0.

"NuTcAsE" <ra********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Try getting the Host entry using the host name... Dns.GetHostEntry
("PC_02"); and see if it returns the right IPAddress. If the IPAddress
returned is different then your DNS server is not mapping 192.168.0.20
as PC_02, or if an exception occurs then the DNS server cannot resolve
the address...

This is not a bug but a behaviour of how DNS lookups are done. IP
address that do not have related DNS records will be returned with the
host name as the ip address provided in the lookup.

Hope this helps...
- NuTcAsE

Feb 7 '06 #3

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

Similar topics

3
by: ad | last post by:
Hi, I use the code below to get the IP of computer: My computer has only one ip: 192.168.0.100, But there are tree IPs get by GetHostEntry: 192.168.0.100 192.168.0.1 192.168.122.1 Why?
1
by: Scott J. Peterson, MCSD, MCPSB, MCT | last post by:
I'm trying to emulate passing the 'SERVER' parameter in an NSLOOKUP using the Dns namespace, but I don't see anywhere this can be set. For example, I may do this; IPHostEntry ipEntry =...
4
by: css | last post by:
When I call Directory.Exists for a UNC path like below... if (Directory.Exists(@\\SomeServer\C) == false) { .... } and that server does not exist on the connected network, it takes around a...
3
by: RWF | last post by:
I am trying to do a reverse DNS lookup using Dns.GetHostEntry in .NET 2.0, but it seems to kind of crap out when the result is an answer with multiple records. It doesnt seem to give any type of...
2
by: The Grim Reaper | last post by:
Hi all, I have a small "irritant" to do with DNS resolving in .NET Framework v2.0. For this example, assume the following network information; Local IP address is 192.168.0.10, on a PC named...
7
by: kvnsdr | last post by:
I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP...
3
by: Steve Richter | last post by:
I am using Dns.GetHostByAddress and Dns.Resolve to successfully resolve and IP address to an IPEndPoint. IPEndPoint ep = null; IPAddress ipAddr = IPAddress.Parse(m_sRemoteHost); ep = new...
5
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I am trying to get the DNS name of an arbitrary IP address on the network. If I use GetHostEntry as the documentation suggests I only get the name of the machine I am running the code on. All...
3
by: desire83 | last post by:
hello, im new in c#.net... i have made a server application and a client application for the same machine...the server is suppos to send a string to client when the button on the server application...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.