In Mobile In The Hand 4.0 all the Windows Mobile networking features are found in the InTheHand.WindowsMobile.Net assembly. This contains support for Connection Manager, Internet Sharing and Wireless Manager. This post will look at the Internet Sharing classes. Internet Sharing was introduced in Windows Mobile 5.0 AKU 3 but is generally associated with Windows Mobile 6. You can share an internet connection over a USB connection or over Bluetooth using the PAN (Personal Area Network) profile. To enable or disable a sharing session from your code you need only call a single method which looks like this:-
The first argument is a member of the SharingConnection enumeration which contains values for Bluetooth and Usb. The second argument is the name of the internet connection to use – this is the name of the GPRS connection which will be dialled. A simple Disable method exists to shut down the sharing connection:-
You must remember to disable the connection once you have finished using it.