D
David
I have this code:
try
{
IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;
foreach (IPAddress address in addresses)
{
if (address.AddressFamily == AddressFamily.InterNetwork)
{
m_strServeIP = address.ToString();
break;
}
}
}
catch (SocketException ex)
{
MessageBox.Show(ex.Message);
Close();
return;
}
A SocketException is thrown "No such host is known".
Yet, I know I have connectivity since I can browse the internet and I have a
valid ip address and it can be pinged from the david-1 computer. My DHCP
server is giving out dns and gateway information. Why does the GetHostEntry
fail?
try
{
IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;
foreach (IPAddress address in addresses)
{
if (address.AddressFamily == AddressFamily.InterNetwork)
{
m_strServeIP = address.ToString();
break;
}
}
}
catch (SocketException ex)
{
MessageBox.Show(ex.Message);
Close();
return;
}
A SocketException is thrown "No such host is known".
Yet, I know I have connectivity since I can browse the internet and I have a
valid ip address and it can be pinged from the david-1 computer. My DHCP
server is giving out dns and gateway information. Why does the GetHostEntry
fail?