Get local IP on PPC without DNS

J

jeep

I am trying to provide a list of local IPs on my PPC (WM 2003) for use
in a UDP application. dns seems to be the most common moethod, but it
is not available in the environment. It is likely that there will be a
wifi and bluetooth connection available so I need the user to select
the appropriate IP (likely wifi).
 
E

Eric

jeep said:
I am trying to provide a list of local IPs on my PPC (WM 2003) for use
in a UDP application. dns seems to be the most common moethod, but it
is not available in the environment. It is likely that there will be a
wifi and bluetooth connection available so I need the user to select
the appropriate IP (likely wifi).

wish this could help :)

using System;
using System.Net;

// *usage* Demo '--hostname'

public class Demo
{
public static void Main(string[] argv)
{
try{
if(argv.Length == 0)
return;

IPHostEntry hostInfo = Dns.GetHostByName(argv[0]);
if(hostInfo.AddressList.Length >= 1)
{
Console.WriteLine("{0}", hostInfo.AddressList.Length);
foreach(IPAddress ipa in hostInfo.AddressList)
{
Console.WriteLine("{0}",ipa.ToString());
}
}
} catch(Exception e) { }
}
}
 
P

Paul G. Tobey [eMVP]

That's not a problem. On the PC, the way this specific type of thing is
actually done is *not* with DNS, which is a defined protocol for querying
well-known servers for translations between things like www.microsoft.com
and the IP address where that server can be found. To provide a local list
of mappings on the desktop, you'd use a 'hosts' file. On Windows CE, you
can store something like that in the registry:

HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\host name

The settings are documented in MSDN on a page titled "TCP/IPv4 Configurable
Registry Settings".

Paul T.
 

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