Sample Application

The sample application (FtpView) demonstrates each of the steps in connecting to and disconnecting from the network. It also highlights the resources consumed as the process goes through each step. As an end user application, it lacks a certain appeal; one might even say it’s useless. But it clearly illustrates the issues involved in initializing, opening, and closing the Net Library. It is the first step on the road to becoming a Palm networking guru.

The main things you must do in every Palm OS network application you write are:

  1. Make sure the Net Library is installed and that your application is compatible with it by retrieving its version number.

  2. Obtain a reference to the Net Library from the operating system by calling SysLibFind.

  3. Open the Net Library by calling NetLibOpen. Be sure to check for errors both in the return value and in the interface error parameter. If the library is already open or an interface error is returned, check the state of the interface you are interested in to make sure it is loaded.

When you are finished with the network, call NetLibClose. Unless you have a really compelling reason for closing your connection immediately, you should specify a delayed closing.

Of course, there’s still a fair amount of work to do between steps three and four: connecting to the network, establishing connections with remote hosts, and exchanging data. We cover these topics in depth in Chapter 7 through Chapter 12.

Application Startup

When the application ...

Get Palm OS Network Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.