473,401 Members | 2,127 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,401 software developers and data experts.

Dns.GetHostEntry .NET 2.0

RWF
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 answer.

The old Dns.GetHostByAddress seems to work partially by atleast returning 1
IpHostEntry, but it has been deprecated.

Any ideas on how to retrieve the multiple records?

example:
Dns.GetHostEntry(IPAddress.Parse("207.46.130.108") );
vs.
Dns.GetHostByAddress(IPAddress.Parse("207.46.130.1 08"));
Jan 9 '06 #1
3 7429
RWF,

My guess is that they cleaned up the call so that if there is not a DNS
entry for this IP address (and there is not), then it throws an exception to
indicate so (a better solution would have been to return null, in my
opinion).

However, I would say it is not a bad thing to throw an exception, after
all, there is no host entry to be found to begin with!

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"RWF" <RW*@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
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 answer.

The old Dns.GetHostByAddress seems to work partially by atleast returning
1
IpHostEntry, but it has been deprecated.

Any ideas on how to retrieve the multiple records?

example:
Dns.GetHostEntry(IPAddress.Parse("207.46.130.108") );
vs.
Dns.GetHostByAddress(IPAddress.Parse("207.46.130.1 08"));

Jan 10 '06 #2
Does this blow up also?

IPHostEntry he = Dns.GetHostEntry("207.46.130.108");
if (he.Aliases.Length == 0)
{
Console.WriteLine("No host name by that address.");
return;
}
foreach(string alias in he.Aliases)
{
Console.WriteLine(alias);
}

--
William Stacey [MVP]

"RWF" <RW*@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
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 answer.

The old Dns.GetHostByAddress seems to work partially by atleast returning
1
IpHostEntry, but it has been deprecated.

Any ideas on how to retrieve the multiple records?

example:
Dns.GetHostEntry(IPAddress.Parse("207.46.130.108") );
vs.
Dns.GetHostByAddress(IPAddress.Parse("207.46.130.1 08"));

Jan 10 '06 #3
RWF
It doesnt blow up, it just fails to return a HostName for the IPHostEntry,
but 207.46.130.108 is an IP for Microsoft.com, so there has to be something
there. When I go to dnsstuff.com and do a reverse lookup on that IP, maybe
10-15 results are returned.

"William Stacey [MVP]" wrote:
Does this blow up also?

IPHostEntry he = Dns.GetHostEntry("207.46.130.108");
if (he.Aliases.Length == 0)
{
Console.WriteLine("No host name by that address.");
return;
}
foreach(string alias in he.Aliases)
{
Console.WriteLine(alias);
}

--
William Stacey [MVP]

"RWF" <RW*@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
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 answer.

The old Dns.GetHostByAddress seems to work partially by atleast returning
1
IpHostEntry, but it has been deprecated.

Any ideas on how to retrieve the multiple records?

example:
Dns.GetHostEntry(IPAddress.Parse("207.46.130.108") );
vs.
Dns.GetHostByAddress(IPAddress.Parse("207.46.130.1 08"));


Jan 10 '06 #4

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...
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...
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
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
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
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.