WinCE 6.0, work with GPRS / WiFi

I am working on a project that needs to connect to servers via wifi / gprs. Project is a Windows CE 6.0 application that I am writing in Visual Studio 2008 in C #.

I have two severs to work with. First I have to connect via wifi, second via gprs. So I need to know how can I change the connection method between wifi and gprs?

I found and tried this way: I enable both wifi and gprs on my device. So I work over Wi-Fi because it has a higher priority. When I need to work through gprs, I will disable the wifi ( SetDevicePower

) function . But when I turn on Wi-Fi, it doesn't connect to my preferred network.

Also I've heard about how to programmatically change the priority between gprs / wifi in the OS priority table, but I haven't found any information on how to do this.

I hope you can help me.


source to share

1 answer

I would use the route command from the shell.


server1 ip:
server2 ip:

wifi ip   :

gprs ip   :


You can now subtract on the command line

route add MASK



route add: MASK


This should route all traffic to server 1 over wifi and server 2 over gprs without changing a single line of code in your application.

You can check if it works with



However, you can use your app to periodically do this task (I assume the gprs ip may change from time to time) using Process.Start (...)

- delete route 1
- add route 1
- delete route 2
- add route 2


You could even specify an interface using a switch IF 2

(the route list prints the interface id for your network cards).

Another interesting post to read:

The author uses GetAdapterAddresses () and CreateIpForwardEntry () P / Invokes:



All Articles