Chapter 6. Hello, NetLib
Before we dive into the nuts and bolts of network programming, let’s make sure that the basic plumbing is in place. In this chapter, we cover the mechanics of initializing, opening and closing the Net Library, and the protocol stack. We examine the resources required by the protocol stack across the various versions of the Palm OS, and we also connect to the network.
Initializing the Net Library
The first step to using the Net Library is to initialize it. This is a fairly simple process. First, determine whether the Net Library is installed and, if so, which version is installed. Then locate the Library and save a reference to it. This reference will be passed to all subsequent function calls. Once you’ve done this, you’re ready to hit the network.
Existence and Version Checking
Protocol stacks do an awful lot of work building and addressing packets, and as we will see, they use a lot of memory to do it. The Palm engineers knew that the Net Library was going to take up a lot of resources. They also knew that they couldn’t know what size and shape Palm OS devices might take in the future. They imagined that a device might come along which not only did not need network access, but also could not afford the resources required to support network access.
So it is possible that your network application might find itself running on a device with no network support. And, being the professionally-minded sort of person who would buy this book, you will want to make ...