Re: Dns.GetHostEntry functionality
- From: "David" <david@xxxxxxxxxxx>
- Date: Fri, 14 Mar 2008 10:23:13 -0600
If I substitute 10.0.0.20 for david-1, everything works fine. That is, the functionality of my app works to connect to the PC and retrieve data and send data. So this tells me that I have connectivity to the network. It is just that DNS seems not work work. Does Vista not use netbios names? I am pretty sure that it does.
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com> wrote in message news:uhopxtehIHA.6136@xxxxxxxxxxxxxxxxxxxxxxx
The only thing that I can think of is that the name you're asking for is wrong (isn't the real device name), or that there's a bug in resolution for NetBIOS names with - characters in them. What sort of device are we talking about (it's not Windows Mobile, for example?)? Version of CE? Networking components built in?
Your code works fine on my device.
Paul T.
"David" <david@xxxxxxxxxxx> wrote in message news:B3DAB770-2D94-4BE6-8899-B0C51B61F484@xxxxxxxxxxxxxxxxI 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?
.
- Follow-Ups:
- Re: Dns.GetHostEntry functionality
- From: Paul G. Tobey [eMVP]
- Re: Dns.GetHostEntry functionality
- References:
- Re: Dns.GetHostEntry functionality
- From: Paul G. Tobey [eMVP]
- Re: Dns.GetHostEntry functionality
- Prev by Date: Re: Dns.GetHostEntry functionality
- Next by Date: Re: Dns.GetHostEntry functionality
- Previous by thread: Re: Dns.GetHostEntry functionality
- Next by thread: Re: Dns.GetHostEntry functionality
- Index(es):
Loading