Preface

Do not seek to follow in the footsteps of the wise, see what they sought.

—Basho

Palm OS-based handhelds are becoming ever more connected as wireless networking technologies evolve and proliferate. More connected devices need networking applications. Developing network applications requires an understanding of Palm’s support for networking, and of the handheld platform itself. Those with an understanding of handheld application development will be in great demand.

The electronic networks and applications that use them are the infrastructure for the next century, just as the interstate highway network was the infrastructure for the last century and the railroad network was the infrastructure for the one before that. Network application developers have a to create high-quality infrastructure and efficient, stable applications. The next economy depends on it.

This book is for developers who want to create quality network applications for the Palm OS platform—applications that run efficiently on the device and on the network, and applications that conserve processor and bandwidth resources.

This book has three objectives:

  1. Introduce the reader to the principles of Palm network applications. This includes the handheld environment, network architectures, communication and application protocols, and programming techniques. Chapter 1, Chapter 2, and Chapter 3 provide an overview of these issues. We explore the specifics of Palm network application development in Chapter 6 through Chapter 13.

  2. Introduce the reader to aspects common to all of Palm network applications. Chapter 4 discusses the development tools available. Chapter 6 and Chapter 7 explore how to connect to the Network and determine the network addresses of remote hosts. Chapter 8 through Chapter 12 contain discussions of general network application development issues, though their main focus is the TCP protocol.

  3. Introduce the reader to the details of Palm network development. Chapter 8 through Chapter 12 explore TCP or stream sockets and general network issues as we implement a subset of the File Transfer Protocol (FTP). Chapter 13 discusses the UDP networking, and how it differs from TCP.

This book illustrates the goals of efficient Palm OS network applications, which network programmers can pursue in their own application development.

Organization of This Book

Palm OS Network Programming is structured into two parts. The first part is a general overview of Palm network application development. The second part delves into the details of Palm network application development as well as the Net Library, the subsystem of the OS that provides access to network resources. It also includes a bibliography with a list of suggested reading.

This section provides an overview of the Palm network environment, and discusses the tools and techniques for creating solid applications that run efficiently in this environment. Newcomers to network application development should learn the basics of networks and network application development. Experienced desktop or server network application developers should find interesting differences and nuances in handheld networking. Expert Palm network developers can just skip this part altogether.

Chapter 1

This chapter provides a brief history of Palm devices, with special regard for the evolution of network support as new devices and operating system versions have been released. It also provides an overview of the options for connecting Palm handhelds.

Chapter 2

This chapter examines the Open System Interconnect (OCI) model (the ISO standard for network protocol stacks), and discusses the specifics of the Palm OS network protocol stack. It deals with the protocols in the following stack: TCP, UDP, and IP. It also describes the Sockets interface model, which allows Palm Network applications to access these protocols, and through them, the network beyond.

Chapter 3

This chapter explores the Zen of Palm and the Tao of Networks. The Zen of Palm is the design philosophy behind the Palm platform and the devices that run on it. The Tao of Networks is the philosophy for general network development. This chapter also presents a high-level design for the two example applications developed in this book, FtpView and DayTimePeer. These designs provide the framework for implementing our applications in accordance with these philosophies. These applications are implemented in Chapter 6 through Chapter 13.

Chapter 4

This chapter examines the development tools available for creating, testing, and debugging Palm OS applications in C or C++.

Part II is the heart of the book. It examines the actual Palm OS support for network applications, as we build the two example applications. This part is intended to be read in sequence, but the information is laid out such that it can be used for reference as well.

Chapter 5

This chapter provides a guided tour of the Net Library, and describes its physical and logical architecture. This architecture will inform the design decisions made in the development of the two example applications.

Chapter 6

This chapter discusses establishing a connection to the network, as well as the resources consumed by this connection. It examines the implications of connecting to the network, and how these affect the decision of when to connect and when to disconnect. It introduces the first example program, which illustrates how to connect to and disconnect from the network.

Chapter 7

One of the fundamental problems in network application development is finding and identifying remote services. Chapter 7 explains how host computers and services are identified on a TCP/IP network, and describes the hostname and address resolution and service resolution functions available from the Palm OS Net Library. Use of these functions is illustrated in the revised example application.

Chapter 8

This chapter revisits the TCP protocol and the connection semantics it provides. It explains how TCP connections are created and destroyed on the Palm platform. This chapter introduces the first revision of FtpView, based on the example from Chapter 7, which simply opens and closes a socket connection to an FTP server.

Chapter 9

This chapter discusses sending and receiving data over a TCP socket connection, and introduces the Palm OS functions that support network data exchange. The FTP login process is discussed; FtpView is extended to allow user to login to an FTP server.

Chapter 10

This chapter explains how to implement network applications as event-driven programs, rather than the batch approach taken in Chapter 9. It introduces the architectural changes required and the Palm OS functions that enable this architecture. It illustrates how state diagrams are used to document the event-driven application flow and revises FtpView accordingly.

Chapter 11

Chapter 11 explains how a TCP connection server handles incoming connection requests and shows how Palm OS network applications use the Net Library to serve TCP connections. FtpView is extended to retrieve directory listings from the server. This requires a data connection, which FtpView accepts from the FTP server.

Chapter 12

The final enhancement to FtpView is made in Chapter 12. Up until this chapter, the sockets all operate in blocking mode. This chapter explains the difference between blocking and nonblocking sockets, and describes the advantages and challenges of nonblocking sockets.

Chapter 13

This chapter explains the User Datagram Protocol (UDP) and explains how its use differs from TCP connections, including a discussion of programming considerations and when to use UDP versus TCP. A new sample application, Daytime Peer, illustrates the use of UDP sockets.

Chapter 14

This bibliography contains a list of suggested reading for using the Palm, developing Palm and Network applications, and general C development. It also contains a list of books that explain various aspects of Zen and Buddhism.

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.