472,978 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,978 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 7383
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.