473,698 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dns.GetHostEntr y .NET 2.0

RWF
I am trying to do a reverse DNS lookup using Dns.GetHostEntr y 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.GetHostByAd dress 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.GetHostEntr y(IPAddress.Par se("207.46.130. 108"));
vs.
Dns.GetHostByAd dress(IPAddress .Parse("207.46. 130.108"));
Jan 9 '06 #1
3 7447
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.co m

"RWF" <RW*@discussion s.microsoft.com > wrote in message
news:22******** *************** ***********@mic rosoft.com...
I am trying to do a reverse DNS lookup using Dns.GetHostEntr y 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.GetHostByAd dress 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.GetHostEntr y(IPAddress.Par se("207.46.130. 108"));
vs.
Dns.GetHostByAd dress(IPAddress .Parse("207.46. 130.108"));

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

IPHostEntry he = Dns.GetHostEntr y("207.46.130.1 08");
if (he.Aliases.Len gth == 0)
{
Console.WriteLi ne("No host name by that address.");
return;
}
foreach(string alias in he.Aliases)
{
Console.WriteLi ne(alias);
}

--
William Stacey [MVP]

"RWF" <RW*@discussion s.microsoft.com > wrote in message
news:22******** *************** ***********@mic rosoft.com...
I am trying to do a reverse DNS lookup using Dns.GetHostEntr y 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.GetHostByAd dress 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.GetHostEntr y(IPAddress.Par se("207.46.130. 108"));
vs.
Dns.GetHostByAd dress(IPAddress .Parse("207.46. 130.108"));

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.GetHostEntr y("207.46.130.1 08");
if (he.Aliases.Len gth == 0)
{
Console.WriteLi ne("No host name by that address.");
return;
}
foreach(string alias in he.Aliases)
{
Console.WriteLi ne(alias);
}

--
William Stacey [MVP]

"RWF" <RW*@discussion s.microsoft.com > wrote in message
news:22******** *************** ***********@mic rosoft.com...
I am trying to do a reverse DNS lookup using Dns.GetHostEntr y 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.GetHostByAd dress 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.GetHostEntr y(IPAddress.Par se("207.46.130. 108"));
vs.
Dns.GetHostByAd dress(IPAddress .Parse("207.46. 130.108"));


Jan 10 '06 #4

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

Similar topics

3
6969
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
2532
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 = Dns.GetHostEntry(strServerIP); ....but I want to specify WHICH DNS server to resolve against, not just the default. From a command prompt I would do NSLOOKUP, then type SERVER
4
15092
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 minute to return from the call which properly returns false.
2
6196
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 "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"
2
5383
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 "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"
7
2152
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 that is entered. What's up Microsoft???? I can say that before we switched over .NET 1.1 to 2.0 the Dns.Resolve(entry); would find a name for any IP, LAN or WAN. Q. Any ideas??????????
3
16599
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 IPEndPoint(Dns.GetHostByAddress(ipAddr).AddressList, m_iRemotePort); // ep = new IPEndPoint(Dns.GetHostEntry(ipAddr).AddressList, m_iRemotePort); // ep = new IPEndPoint(Dns.Resolve(m_sRemoteHost).AddressList,
5
14536
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 other IP’s returns the IP in the HostName property of the IPHostEntry object returned by GetHostEntry. If I use Dns.GetHostByAddress or Dns.Resolve I get the name, but these are marked as obsolete. What is the correct way to get this...
3
15568
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 is pressed...but im not recieving the string on my client application here are the codes for both the applications SERVER: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;
0
8673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.