Changing IP Address

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am developing an app for PPC that requires changing the IP Address at
runtime.
Is there anybody know how to accomplish it using c#?

I tried to search but couldn't get any information on it.

Thanks,
Sam
 
Use the OpenNETCF SDF, finding the Adapter instance that you want to change,
setting its IP address, and calling RebindAdapter() on it. There's no
built-in way in the .NET CF to do that...

Paul T.
 
Thanks for the response...

I am using .NET CF 2.0 to build my app.
Is OpenNETCF SDF supported?

Thanks
 
Hi Paul.

I tried using Adapter class, but for some reason I still cannot change the
IP add

here is my code:

AdapterCollection adapters = Networking.GetAdapters();
foreach(Adapter adapter in adapters)
{
if(adapter.IsWireless)
{
adapter.CurrentIpAddress = "123.123.123.234";
adapter.RebindAdapter();
}
}
 
I don't notice anything wrong with that. Is the adapter configured for
static IP address assignment to begin with? There are two sets of
parameters, one for static addressing and one for DHCP-assigned addresses.
If you're changing from DHCP to static, you have to set all of the
parameters (subnet mask, gateway, etc.) That's the only thing that I can
think of, offhand.

Check the settings in the registry and make sure that the static address
that you've specified is there in the right place for the adapter that
you're changing. You should, of course, already have run the debugger
through this code to make sure that you *are* changing the IP of something
(and, of course, that you've only changed *one* adapter).

Paul T.
 
And, I should say, you have to set the DHCP registry value, a DWORD, to 0,
to change from DHCP to static addressing. It's in the same path where the
IP itself is written (you can check the code in the SDF).

Paul T.
 
Back
Top