Table of ContentsChapter 22.            Making the ConnectionNetwork Gaming

Mobile Communications

An MID is by definition a mobile device. That means in almost all cases they communicate without any type of fixed wires; in other words, they're wireless. There are three methods of communication you can practically use right now: SMS/MMS, Bluetooth, and HTTP. You should start by taking a look at these three in a little more detail.

SMS/MMS

SMS (Short Message Service) is available on almost all mobile devices (certainly all phones). Using the service you can send a short message (less than 160 characters) from one device to another using the target device's phone number. A target device need not be on the same carrier network.

SMS messages are not transmitted directly to the destination device; rather, an SMSC (Short Message Service Center) acts as a gateway to relay messages to their destinations.

Figure 22.1. Short Message Service (SMS) messages are transmitted via an SMSC acting as a gateway to relay messages.

graphic/22fig01.gif


SMS is optionally supported as part of the Wireless Messaging API (WMA) version 1 (JSR 120). MMS is supported by the second edition of the WMA covered by JSR 205. Although support for WMA 1 or 2 isn't mandatory, it is becoming quite common for modern devices. Check the manufacturer specifications for each device to see whether it's supported.

Bluetooth

Bluetooth is a short-range radio (2.4 GHz Industrial Scientific Medical band) signaling system that provides communications between mobile devices within a range of about 10 meters (30 feet).

Figure 22.2. Bluetooth devices communicate directly with each other over short-range radio transmissions (at 2.4 GHz).

graphic/22fig02.gif


Bluetooth has gained very broad industry support, with more than 2,000 companies actively involved in its development and deployment. Due to its low range, Bluetooth transmitters are both compact (small and lightweight) and low cost, which allows manufacturers to include it within a device economically. Bluetooth is a popular feature of newer MIDs.

Unlike infrared, communicating via Bluetooth does not require line of sight. You simply need to get near another compatible device and bing . . . you're talking. Also unlike infrared, Bluetooth is not limited to one-to-one communication; multiple devices can have a little party together, which is great for multiplayer gaming.

NOTE

Note

Do not confuse Bluetooth with IEEE 802.11b wireless LAN technology (and friends). Bluetooth is designed to provide inexpensive short-range (30 feet) communications at up to 1 Mbps. 802.11 is built for much larger devices, such as PCs, and communications at 11 Mbps at a range up to 300 feet.

Bluetooth is not part of the MIDP 1 specifications, but it is supported through the JSR 82 API. As with SMS, check the manufacturer specifications on your target devices to determine whether you have access to Bluetooth from Java.

HTTP

The only communications mechanism mandated as part of the MIDP 1 specifications is HTTP (Hypertext Transfer Protocol). Although this isn't a protocol you'd typically use as the basis for multiplayer games (a custom protocol based on UDP or TCP is more appropriate), it's still powerful enough to get a fair bit done.

An interesting thing to note about MIDP HTTP is that it may not necessarily be implemented over TCP. Most of the time MIDs use WAP (Wireless Application Protocol) instead. That's rightWAP lives!

To use HTTP you need to set up an HTTP server along with server-side code (servlets) to respond to your MID's requests. Access to the HTTP client is available by default with the MIDP 1 API.

Figure 22.3. HTTP connections go via a carrier's Internet gateway.

graphic/22fig03.gif


    Table of ContentsChapter 22.            Making the ConnectionNetwork Gaming