Wireless peer to peer name resolution

S

Steve McKewen

I am working on Windows Mobile 6 with VS2005.

I want my mobile devices to connect to a shared folder on a PC in an
isolated network environment. I don't have a server or router in the
network, so don't have a DNS server.
I can ping the PC using its IP address, but not its hostname.
I have written a ping routine using a dotnet socket to send an
IcmpPacket.
I can connect to the shared folder by the hostname but not the IP address.
I am using a System.IO.DirectoryInfo object to open the share.

I want to connect the the share \\ControlPC\temp on the PC named ControlPC
at 192.168.0.5
I can ping 192.168.0.5, but I can't find the hostname for that IPAddress.
I can connect to the share at \\ControlPC\temp, but not \\192.168.0.5\temp

I tried to resolve the IPAddress to a name using System.Net.Dns.GetHostEntry
but just get an exception "No such host is known".
Is there a way around this without adding a DNS server to my network?

Thanks
Steve in ABX
 
S

Steve McKewen

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
 
S

Steve McKewen

Further testing

When I try to resolve the name to an IP address

System.Net.IPHostEntry aIPHE = System.Net.Dns.GetHostEntry("oar-pc");

I get "The system detected an invalid pointer address in attempting to use a
pointer argument in a call". exception.
If I change the hostname to an name that is not available on the network
like this:


System.Net.IPHostEntry aIPHE = System.Net.Dns.GetHostEntry("oar-pc1");

then I get "No such host is known" exception as expected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top