471,356 Members | 1,643 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

Wireless peer to peer name resolution

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
Sep 4 '08 #1
5 2046
On Wed, 03 Sep 2008 19:39:33 -0700, Steve McKewen <st******@albury.nsw.au>
wrote:
[...]
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?
This is more of a network config question than a programming question.
You would probably get better, more useful answers if you posted your
question to a more appropriate forum.

That said: I don't understand why you can't connect by IP address (seems
to work okay for me). It might help if you could be more specific than
simply saying you can't do it.

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).

I realize that answer is "hand-wavy". Like I said, you'd probably be
better off posting to a different forum. :)

Pete
Sep 4 '08 #2
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. :)
Sep 4 '08 #3
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. :)

Sep 4 '08 #4
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.
Sep 4 '08 #5
On Thu, 04 Sep 2008 00:17:49 -0700, Steve McKewen <st******@albury.nsw.au>
wrote:
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.
Sounds like a bug to me. You might consider reporting the behavior on the
http://connect.microsoft.com/ web site.

Of course, your question is really more specific to Windows Mobile and
there's lots about that I have no experience with. But all of the
behaviors your describing sound like there's some sort of disconnect
between .NET and what's supported in the underlying Windows API. Both
have reduced functionality on mobile/compact platforms, of course. But it
sounds as though .NET may be making some assumptions about what the
underyling unmanaged API supports that turns out to be incorrect.

I'm especially boggled that the IP-based UNC path doesn't work. I'd have
thought that'd require the least amount of effort on the part of the OS,
so I almost wonder if .NET is getting in your way there. If p/invoke is
supported on Windows Mobile, you might consider at least doing a test with
that to see if you can work around limitations in .NET, if not use that as
an actual solution.

For the best advice though, you should really post your question and
observations to a forum specific to Windows Mobile. You'll get a much
wider group of people with relevant experience there (wherever "there" is,
of course...I don't actually know off the top of my head).

Pete
Sep 4 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Donnal Walter | last post: by
8 posts views Thread by Peter Larsson | last post: by
reply views Thread by David Pendrey | last post: by
reply views Thread by EoRaptor013 | last post: by
21 posts views Thread by Johan Tibell | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.