Let's have a look at how a J2ME Palm device application can get access to the Internet. The options for connecting a Palm to the Internet are numerous, and vary a little depending on where you live. The following table summarizes the options.
There are three basic options:
Connect the Palm to a PC that has Internet access. This can be done by:
Direct serial. Connect the Palm in its cradle to a COM port of the PC and use Mochasoft W32 PPP or Windows RAS to connect to the Internet through the PC's modem or network connection.
 Refer to http://www.mochasoft.dk/home.html for more information.
InfraRed. Use a virtual IR COM port such as IrCOMM2k and connect to Mochasoft W32 PPP through the Palm's IR port.
 Refer to http://www.ircomm2k.de/.
Bluetooth. Use the Palm Bluetooth Card to connect to a Bluetooth-enabled PC, such as a Toshiba or Macintosh.
Connect the Palm to a mobile phone with an built-in modem to dial an ISP.
Connect the Palm to a network that has Internet access. The Palm Bluetooth Card can connect to LAN access points such as Pico, Red-M, and Widcomm.
If you live in the United States, you have all the above options plus one more:
Palm.Net. If you have a Palm i705 and live in one of 260 U.S. cities in which Palm.Net has a presence, you can use the i705 to access the Internet.
 Refer to http://www.palm.com/cgi-bin/coveragemap.cgi for a Palm.Net coverage map.
In this chapter we will look at Options 1 and 2 (direct serial and IR connections, respectively) in step-by-step detail.
To connect the Palm to the Internet using this method, you will need the following:
Mochasoft's W32 PPP
 W32 PPP does not support connections through a USB cradle or Handspring Visor devices.
Palm cradle connected to the PC's COM port
Install W32 PPP and set up a new PPP connection over a direct serial connection on the Palm. This is done by selecting System | Preferences, and clicking on the Service | New menu. Name the service "Direct PPP," and select "Direct Serial" as the Connection. There is no need to enter a user name or password. Under Details, select "PPP" as the Connection type, and click OK.
Make sure that the baud rate on the PC is the same as the Connection being used on the Palm. When you start W32 PPP, you should see a window similar to that in Figure 7.4.
To make a connection to W32 PPP from the Palm, go to System | Preferences | Network, select "Direct PPP," and click Connect. Then the Palm is ready to start the networking Java application.
The "Bytes to Palm" and "Bytes from Palm" fields show the number of bytes flowing to and from the Palm, which is a helpful indication that the connection is being made.
To use the Infrared connection option, you need the following:
A Palm with an IR port
A PC with an IR port
IrCOMM2k?Virtual Infrared COM Port for Windows 2000/XP.
Mochasoft's W32 PPP.
First of all, make sure that the IR port on the PC is enabled. This can be configured into the BIOS settings on the PC. If the IR port is enabled, Windows will display an icon in the Control Panel, as shown in Figure 7.5.
Install IrCOMM2k as described in the instructions. Don't forget to disable the IR port for digital image transfer. IrCOMM2k is installed as a Windows service that emulates a COM port; you will be asked to specify which spare COM port to use. Often, COM4 is a spare port, but this depends on your PC's configuration. Configure W32 PPP to use the COM port being emulated by IrCOMM2k.
There are two main methods for connecting to the Internet using a mobile phone. The first is by using a data-enabled phone and connecting the Palm OS to the phone using the Infrared port. A data-enabled phone is one that has a built-in modem. For example, Nokia's current list of "data supported" mobile phones is as follows:
Instructions for setting up the Palm OS and the phone for dialing an ISP and making a connection to an ISP are in the user guide for each of the above phones. They can also be found at http://www.nokia.com.
The second method is by using a direct connection cable, such as the GlobalPulse product from TDK. This cable supports a wide variety of phones from Nokia and Ericsson. Refer to http://www.gsm4palm.com for more information.
The following example uses a Palm OS with a Nokia 8210 GSM mobile phone.
First, set up an IR modem connection in the Palm (Figure 7.6). To do this, tap on the Prefs icon and select the Connection menu. Create a new connection and call it IR Modem.
Tap OK. Now go to the Network menu item and set up a service that uses the new IR Modem connection. If you are dialing your ISP, enter the user name, password and ISP phone number into the Network screen (Figure 7.7).
Before a connection can be made, the IR port on the Nokia needs to be enabled. To do this, select Menu | Infrared | Select. The Nokia will display a message saying that Infrared reception is enabled.
To connect, tap on the Palm's Connect button. The Palm will make a connection through the IR port to the Nokia, and the Nokia will dial the ISP and make a PPP connection. Once the connection is made, network applications can access the Internet. To test the connection, start the HttpNetworking application and get the test page. It should work the same way as all the other connection methods.