RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Windows Mobile: Communicating with the Outside World

Explore the various options available on the .NET Compact Framework that allow your apps to connect with the outside world.

n last month's DevX special report, I showed you how you can develop for the Windows Mobile platform using the .NET Compact Framework. Now, you'll expand on those concepts and learn how you to explore the various communication options available on this platform so that your applications can connect to the outside world. In particular, this article will discuss:
  • Short-range communications technologies such as:
    • Infrared
    • Bluetooth/serial port
  • Long-range communications technologies such as:
    • WIFI
You'll also learn how you can use the managed APIs in the .NET Compact Framework to program:
  • Infrared communications
  • Serial communication over Bluetooth
  • Sockets communications
  • Web services
The last section of this article shows how to develop a Windows Mobile application to take pictures using the built-in camera and then upload the picture to a web service.

Infrared communication is one of the most common forms of communication for devices today. If you've ever used a TV remote control, you've experienced the convenience of using infrared communications. While infrared communications require line-of-sight between the sending and receiving devices, they are a quick and cheap way of communicating between devices.

The beauty of infrared is that it requires no pairing of devices, and certainly does not require the hassles of exchanging secret pin numbers (unlike Bluetooth). For this reason, it is suitable for applications that require fast exchanges of information. For example, you might want to use infrared to exchange electronic business cards with a business associate. In the .NET Compact Framework, the core classes for infrared functionalities are located in the System.Net.Irda.dll DLL. Hence, you'd need to add a reference to this file in your project.

For the code described below, you need to import the following namespaces:

using System.IO;
using System.Net;
using System.Net.Sockets;

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date