Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

.Net 2.0 & Dns.GetHostEntry

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe K - 04 Apr 2007 20:11 GMT
I am intermitently getting a System.Net.Sockets.SocketException ("No such
host is known") when calling Dns.GetHostEntry().  It doesn't seem to have
any pattern to it, but seems to be occurring on a variety of IP addresses
(e.g. internal addresses such as 192.168.x.x).  Anyone else see this?  Is
there a known .Net 2.0 bug for this?

Joe
Joe K - 04 Apr 2007 21:08 GMT
So I verified this fails any time there is a DNS configuration that results
in nslookup returning an error regarding "Non-existent domain."  In my case
this is a system that is not part of a domain but is performing an nslookup
on a system that is in a domain.  Oddly enough, the deprecated method
Dns.GetHostEntry replaces, Dns.GetByName, works flawlessly.  Below you will
find the sample code to reproduce and the nslookup results.

It seems this is a .Net 2.0 bug.

******nslookup results******
nslookup -type=ptr 192.168.100.10
Server:  my-dc.mycompany.int
Address:  192.168.100.10

*** my-dc.mycompany.int can't find 192.168.100.10: Non-existent domain

******Sample Code******
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace TestDns
{
   class Program
   {
       static void Main(string[] args)
       {
           if (args.Length < 1)
           {
               Console.WriteLine("TestDns [ip address or hostname]");
               return;
           }
           Console.WriteLine("Test #1");
           try
           {
               Console.WriteLine(Dns.GetHostEntry(args[0]).HostName);
           }
           catch (Exception ex)
           {
               Console.WriteLine(ex.Message);
               Console.WriteLine(ex.StackTrace);
           }
           Console.WriteLine("Test #2");
           try
           {
               Console.WriteLine(Dns.GetHostByName(args[0]).HostName);
           }
           catch (Exception ex)
           {
               Console.WriteLine(ex.Message);
               Console.WriteLine(ex.StackTrace);
           }
       }
   }
}
Peter Duniho - 04 Apr 2007 21:55 GMT
> So I verified this fails any time there is a DNS configuration that  
> results in nslookup returning an error regarding "Non-existent
[quoted text clipped - 5 lines]
>
> It seems this is a .Net 2.0 bug.

I don't know what the problem is, but one person wrote a comment to this  
documentation page:
http://msdn2.microsoft.com/en-us/library/ms143998.aspx

...that seems to confirm the problem you're having (though in a slightly  
different example, the behavior seems basically the same problem).

I wonder if you or the other person has reported this problem as a bug  
yet.  I haven't run into it myself, but if you have a reproducible  
example, you should probably report it so that it can be fixed.

Pete
Joe K - 04 Apr 2007 22:55 GMT
Yes, I think I have a reproducible case but it requires a specific DNS
setup.  The link you pointed me to sounds exactly like my issue, but I think
the poster didn't realize there is a more specific setup required to
reproduce (e.g. I can run his test case without a problem).

I wasn't planning on reporting it as a bug due to the sheer effort to push
this through Microsoft (e.g. open a case, wait a week for callback, work
through 1st level engineer, wait for engineer to setup & reproduce, wait for
engineer to talk with development, wait for development to acknowledge as a
bug, etc.., etc...).  Okay, okay, I am a bit jaded by my last two
experiences in which after all that effort, the product failures we actually
deemed documentation bugs!

If anyone has more details, I'd be interested.  In the meantime, I will be
making a critical hotfix to our application that uses the deprecated method
instead of GetHostEntry.

Thanks for reply.

Joe

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.