PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Get local IP on PPC without DNS

Reply

Get local IP on PPC without DNS

 
Thread Tools Rate Thread
Old 03-10-2005, 10:23 PM   #1
jeep
Guest
 
Posts: n/a
Default Get local IP on PPC without DNS


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

  Reply With Quote
Old 03-10-2005, 11:52 PM   #2
Eric
Guest
 
Posts: n/a
Default Re: Get local IP on PPC without DNS


"jeep" <kenm16@gmail.com> wrote in message
news:1128374593.347132.102440@g44g2000cwa.googlegroups.com...
> 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) { }
}
}


  Reply With Quote
Old 05-10-2005, 08:16 PM   #3
Paul G. Tobey [eMVP]
Guest
 
Posts: n/a
Default Re: Get local IP on PPC without DNS

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.

"jeep" <kenm16@gmail.com> wrote in message
news:1128374593.347132.102440@g44g2000cwa.googlegroups.com...
>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).
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off