views:

319

answers:

1

I'm coding in OpenNetCF for WIndows Mobile 6.0. I need my application to connect to a particular Ad-Hoc network. I find that if there is no other device connected to that same Ad-Hoc network, the device automatically switched back to some other network (that is currently available). I want my application to stay connected to the Ad-Hoc network, even if there are no other clients (more clients may join later). Is there some way to do this?

A: 

If you are talking about Ad Hoc Wi-Fi, you can

  1. Make a custom OpenNETCF.Net.NetworkInformation.AccessPoint for your device
  2. Add it to preferred networks using WirelessZeroConfigNetworkInterface.AddPreferredNetwork method and
  3. Use WirelessZeroConfigNetworkInterface. ConnectToPreferredNetwork method to connect to it.

If ad hoc network is formed using your device, it will be the ad hoc network chosen by your device, and since this network is formed by your device, you can always be connected to it, regardless of other devices.

CuriousTiger