| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C-Sharp Programming Post questions, answers, and comments about C#. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Host name via Dns.GetHostEntry(ip);
Hi,
I have a problem with resolving a host name (via IP) for some hosts. For that operation I use the following method: Code:
string ip;
try
{
...
IPHostEntry iphost = Dns.GetHostEntry(ip);
......
}
catch (Exception ex)
{
MessageBox.Show("Unable to process the request because " +
"the following problem occured:" + Environment.NewLine +
ex.Message,
"Exception for " + ip);
}
Ideas? |
|
#2
|
||||
|
||||
|
Re: Host name via Dns.GetHostEntry(ip);
It seems that GetHostEntry() is ready for IPv6 while Resolve() expects only IPv4. Can this be the difference? Something in net infrastructure?
__________________
|
|
#3
|
|||
|
|||
|
Re: Host name via Dns.GetHostEntry(ip);
it is an old problem :
http://msdn.microsoft.com/en-us/library/ms143998.aspx IPv4 will live long time, I read that 90% of networks use Ipv4. Perhaps Resolve() uses also the C deprecated functions: gethostbyaddress() and gethostbyname(). MS recommend to replace them on getnameinfo(). Last edited by Victor Kulichkin; November 5th, 2009 at 09:30 AM. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|