Thanks Peter.
My problem (I think) is with the reduced network functionality of the
Windows Mobile 6 dotnet libraries.
If I try to do this with PCs it works without any problems.
I only have this problem on a windows mobile professional device.
If I have a DNS server on the network it works fine, but I don't need a DNS
server for anything else, so I don't want to add one, just to resolve names
and addresses.
My network consists of a PC, and a collection of hand held windows mobile 6
pro devices.
The mobile devices connect to the PC and download configuration files that
include IP addresses of IO modules that they connect to. All subsequent
connections are done by ip address, but I don't seem to be able to connect
to the PC by \\ipaddress\share .
//Resolve the IP Address to a host name
System.Net.IPHostEntry aIPHE = System.Net.Dns.GetHostEntry("192.168.0.12");
//Show the result
this.lblHostName.Text = aIPHE.HostName;
System.String aPath = @"\\" + 192.168.0.12+ @"\" + "temp";
//Get the directory
try
{
System.IO.DirectoryInfo aDI = new System.IO.DirectoryInfo(aPath);
System.IO.FileInfo[] aFIArray = aDI.GetFiles();
foreach (System.IO.FileInfo aFI in aFIArray)
{
listBox1.Items.Add(aFI.Name);
}
}
catch (Exception ex)
{
listBox1.Items.Add(ex.Message);
}
When I run this code fragment,
the IPHostEntry.HostName is "192.168.0.12"
I get an IO Exception when I create aDI.
When I run this code fragment but replace the "192.168.0.12" string with
"oar-pc" (the name of the PC) it works fine.
What I don't understand is how the DirectoryInfo object is using the
hostname to connect, when I can't resolve the ipaddress to a hostname.
Steve
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Wed, 03 Sep 2008 20:09:13 -0700, Peter Duniho
<Np*********@nnowslpianmk.comwrote:
>Also, Windows does support a LAN without a DNS server. The LAN will
"elect" a name server, using (if I recall correctly) NetBIOS as the
supporting protocol. If you're not getting normal name services over
your network, maybe you've got NetBIOS disabled (either as its own
protocol, or enabled under the TCP/IP settings).
Sorry...I mixed things up a little. You can use NetBEUI as the protocol
that naturally implements NetBIOS, or run NetBIOS over the TCP/IP
protocol. I don't think there's an actual NetBIOS protocol you can have
running on your network adapter in Windows.
Of course, I could still be mixed up. But that's the best clarification I
know to make. :)