Palm OS Network Programming

Book description

The wireless revolution has touched off a huge demand for Palm OS network applications. But information on how to connect a Palm is fragmented across dry function listings in the SDK documentation, a couple of book chapters, some sample code, and a few articles on the Palm web site (each of which assumes prior knowledge of network applications). Palm OS Network Programming pulls all the necessary elements together in the first complete guide to developing network applications for the Palm Computing Platform. The author assumes knowledge of Palm programming in C, but no network experience is required. You'll learn Palm network concepts such as transport protocols and client-server applications from the ground up, clearly illustrated with examples using Metrowerks CodeWarrior development environment. The Palm Net Library, essential to any network application development, gets the detailed treatment it deserves, with sample network applications demonstrating how to make the best use of this powerful system library. Palm OS Network Programming is the first complete developer's resource to building creative--and connected--applications for the fastest-growing platform of the 21st century.

Table of contents

  1. Palm OS Network Programming
    1. Preface
      1. Organization of This Book
        1. Part I
        2. Part II
      2. Sample Applications
      3. Conventions Used in This Book
      4. Comments and Questions
      5. Acknowledgments
    2. I. Introduction to Palm Network Development
      1. 1. Connected Palms
        1. A Brief History of Palm OS Networking
          1. The Less Is More Unconnected Organizer
          2. The More or Less Connected Organizer
          3. The Less Is More Connected Organizer
          4. The More Is Less Connected Organizer
          5. The More and More Connected Organizers
        2. Networking Options
          1. Dial-Up
          2. Wireless
          3. Radio Frequency
          4. Ethernet Cradles
          5. Direct Serial
        3. Summary
      2. 2. The Network Application Model
        1. The OSI Model
          1. What Is the OSI Model?
          2. How the OSI Model Works
          3. The Application Protocol Stack
          4. The Network Protocol Stack
          5. Internetworking
        2. OSI Layers
          1. Application Protocols
          2. Presentation Protocols
          3. Session Protocols
          4. Transport Protocols
            1. TCP
            2. UDP datagrams
          5. Network Protocols
          6. Data Link
          7. Physical
          8. Network Programming Interfaces
        3. Summary
      3. 3. Designing Network Applications
        1. The Zen of Palm
          1. The Enlightened Palm Application
          2. The Tao of Networking
          3. The Enlightened Network Application
        2. Designing FtpView
          1. Functional Analysis
            1. Login
            2. Logout
            3. List server directory
          2. Network Architecture
          3. Application Architecture
            1. User interface
            2. FTP client
            3. Network access
        3. Designing Daytime Peer
          1. Functional Analysis
            1. Daytime consumer
            2. Daytime supplier
          2. Network Architecture
          3. Application Architecture
            1. User interface
            2. Daytime Protocol module
            3. Network access
        4. Implementation Plan
        5. Summary
      4. 4. Development Tools
        1. Development Tools
          1. CodeWarrior for Palm OS
          2. PRC Tools
          3. Palm OS Platform SDK
            1. Net Library
            2. Berkeley Sockets “Glue”
          4. Greg’s Palm OS Library
        2. Debugging Tools
          1. Palm OS Emulator
            1. Palm OS ROM images
            2. Debugging network applications with POSE
            3. Configuring the emulator
          2. MochaPPP
        3. Summary
    3. II. Net Library Programming
      1. 5. A Brief Tour of the Net Library
        1. The Design of the Net Library
          1. Architecture
          2. The Protocol Stack
          3. Avoiding Network Traffic Jams
          4. Avoiding Lengthy Redials
          5. Calling the Net Library
        2. Using the Net Library
          1. Finding the Net Library
          2. Configuring the Net Library
          3. Opening the Net Library
            1. Initializing the protocol stack
            2. Loading network interfaces
            3. Checking for errors
          4. Opening the Socket
          5. Configuring the Socket
          6. Naming the Socket
          7. Making a Connection
            1. Initiating a connection
            2. Accepting a connection
          8. Sending Data
          9. Receiving Data
          10. Disconnecting
          11. Closing the Net Library
        3. Summary
      2. 6. Hello, NetLib
        1. Initializing the Net Library
          1. Existence and Version Checking
          2. Locating the Net Library
        2. Connecting to the Network
          1. Opening the Net Library
          2. Determining Interface Failures
          3. Open Counts
          4. Resource Consumption
        3. Disconnecting from the Network
          1. Closing the Net Library
          2. The Dilemma—When to Disconnect?
          3. The Close Wait State
          4. A Bit of Waffle
        4. Sample Application
          1. Application Startup
          2. Connecting to the Network
          3. Disconnecting from the Network
          4. Application Exit
          5. Program Architecture
          6. PnpNetInit( )
          7. PnpNetConnect( )
          8. PnpNetDisconnect( )
          9. PnpNetTerm( )
          10. PrvNetLogOpenCount( )
          11. PrvNetLogInterfaces( )
        5. Summary
      3. 7. Hostnames and Addresses
        1. Hostname Resolution
          1. Hostnames
          2. IP Addresses
          3. Resolution Mechanisms
          4. Net Library Support
            1. NetHostInfoType
            2. NetHostInfoBufType
            3. NetLibGetHostByName
            4. NetLibGetHostAddr
            5. Address conversion
        2. Service Resolution
          1. NetServInfoType
          2. NetServInfoBufType
          3. NetLibGetServByName
        3. Byte Ordering
        4. Sample Application
          1. Application Startup
          2. Name Lookup
          3. Address Lookup
          4. Service Lookup
          5. Application Exit
          6. Program Architecture
            1. PnpNetFindName
          7. PnpNetFindAddress
          8. PnpNetFindService
          9. PrvNetLogAliases
          10. PrvNetLogAddresses
        5. Summary
      4. 8. Making Connections
        1. What Is a Connection?
          1. TCP Connections
          2. Socket Connections
          3. Sockets in a Nutshell
        2. Palm OS Connections
        3. The Life and Times of a Socket
          1. Socket Life Cycle
          2. Opening the Socket
            1. NetLibSocketOpen
          3. Connecting the Socket
            1. TCP connections
            2. NetSocketAddrType
            3. NetSocketAddrINType
            4. NetLibSocketConnect
          4. Identifying a Connection
          5. Disconnecting the Socket
          6. Closing the Socket
        4. Sample Application
          1. Application Startup
          2. Connecting the Socket
          3. Disconnecting the Socket
          4. Program Architecture
            1. PnpNetSocketConnect
            2. PnpNetSocketDisconnect
            3. PrvNetCalcINetAddr
            4. PrvNetCalcSocketType
            5. PrvNetLogSocketInfo
        5. Summary
      5. 9. Exchanging Data
        1. Streaming Data Exchanges
          1. Sending Data
            1. Net Library support
          2. Receiving Data
            1. Net Library support
          3. Shutting Down the Connection
            1. Net Library support
        2. The File Transfer Protocol
          1. Reply Codes
          2. Login
            1. Client connects to server
            2. Client sends the user command.
            3. Client sends password
          3. Logout
        3. Sample Application
          1. Application Startup
          2. Starting the FTP Session
          3. Ending the FTP Session
          4. Program Architecture
            1. Structure PnpFtpInfoType
            2. Function PnpFtpInit
            3. Function PnpFtpTerm
            4. Function PnpFtpLogin
            5. Function PnpFtpLogout
            6. Function PrvFtpIsLogin
            7. Function PrvFtpWriteCommand
            8. Function PrvFtpWriteControl
            9. Function PrvFtpReadResponse
            10. Function PrvFtpReadControl
          5. Network Implementation
            1. Function PnpNetSocketSend
            2. Function PnpNetSocketReceive
            3. Function PnpNetSocketShutdown
        4. Summary
      6. 10. Reading and Writing Responsively
        1. Deconstructing FtpView
        2. The FTP State Machine
          1. Operations and Transactions
          2. Login Transactions
            1. Connect transaction
            2. User transaction
            3. Password transaction
          3. Logout Transactions
            1. Quit transaction
            2. Disconnect operation
          4. Checking Socket States
            1. NetLibSelect
            2. Read-ready conditions
            3. Write-ready conditions
          5. File Descriptor Sets
          6. Multiplexing in a Nutshell
        3. Sample Application
          1. Designing the State Machine
            1. Login transactions
            2. Logout state transitions
          2. Program Architecture
          3. Updating the FTP Interface
            1. FTP transaction codes
            2. FTP transaction state constants
            3. FTP session information structure
            4. Function PnpFtpProcess
            5. Function PnpFtpLogin
            6. Function PnpFtpLogout
            7. Function PnpFtpCanLogin
            8. Function PnpFtpCanLogout
          4. Implementing the State Machine
            1. Function PrvFtpConnect
            2. Function PrvFtpExchange
            3. Function PrvFtpDisconnect
            4. Function PrvFtpUpdate
            5. Function PrvFtpIsTranSuccess
            6. Function PrvFtpQueueCommand
            7. Function PrvFtpWriteCommand
            8. Function PrvFtpReadResponses
            9. Function PrvFtpReadResponse
            10. Summary of FTP changes
          5. Changes at the Network Library Level
            1. Function PnpNetSelect
        4. Summary
      7. 11. Accepting Connections
        1. Serving TCP Connections
          1. Naming the Socket
            1. NetLibSocketBind
          2. Listening for Connection Requests
            1. NetLibSocketListen
          3. Accepting Connection Requests
            1. NetLibSocketAccept
        2. FTP Data Connections
          1. The Data Socket
          2. Listing the Server Directory
          3. Open a Listening Socket
          4. Execute PORT Transaction
          5. Execute LIST Transaction
          6. Socket Constraints
          7. Memory Constraints
            1. NetLibDmReceive
        3. Sample Application
          1. Application Startup
          2. Updating the State Machine
          3. Program Architecture
          4. Updating the FTP Interface
            1. New transaction codes
            2. Data exchange states
            3. Changes to PnpFtpInfo structure
            4. Updated function PnpFtpInit
            5. Updated function PnpFtpProcess
            6. New function PnpFtpList
          5. Implementing the Data Exchange
            1. New function PrvFtpDataExchange
            2. New function PrvFtpDataAccept
            3. New function PrvFtpDataReceive
            4. New function PrvFtpDataComplete
          6. Changes at the Network Library Level
            1. New function PnpNetSocketListen
            2. New function PnpNetSocketAccept
            3. New function PnpNetSocketDmReceive
            4. New function PnpNetSocketGetAddress
            5. New function PnpNetSocketPort
        4. Summary
      8. 12. Optimizing Stream Sockets
        1. Socket Operating Modes
        2. Blocking Sockets
        3. Nonblocking Sockets
          1. Nonblocking Network Operations
            1. Nonblocking connect
            2. Nonblocking accept
            3. Nonblocking send
            4. Nonblocking receive
            5. Nonblocking in a nutshell
          2. The Nagle Algorithm
          3. Nonblocking Sockets and the Palm OS
            1. NetLibSocketOptionGet
            2. NetLibSocketOptionSet
            3. Socket options
            4. NetSocketLinger structure
            5. Nonblocking socket options
        4. Unblocking FtpView
          1. Program Architecture
          2. FTP Interface Changes
            1. Updated structure PnpFtpInfoType
          3. FTP Implementation Changes
            1. Update PnpFtpLogin
            2. Update PrvFtpQueueCommand
            3. Updated PrvFtpConnect
            4. New function PrvFtpCloseControl
          4. Network-Level Changes
            1. Add function PnpNetSocketOpen
            2. Add function PnpNetSocketClose
            3. Updated function PnpNetSocketConnect
            4. Updated function PnpNetSocketListen
        5. Summary
      9. 13. UDP Sockets
        1. What Is UDP?
          1. What Is a Datagram?
          2. UDP Conversations
            1. Peer-to-Peer conversations
            2. Client/Server conversations
            3. Broadcast conversations
          3. Implications of UDP
            1. Bandwidth
            2. Reliability
            3. Complexity
        2. UDP and the Network
          1. Opening the Socket
          2. Binding the Socket
          3. UDP Connections
          4. UDP Conversations
          5. Sending Data
          6. Receiving Data
          7. Closing the Socket
        3. The Daytime Protocol
          1. Loopback
        4. Sample Application
          1. Functional Description
          2. Designing the Daytime Layer
            1. Daytime client
            2. Daytime server
          3. Program Architecture
          4. Initializing and Terminating the Daytime Interface
            1. PnpDtpInfoType
            2. PnpDtpInit
            3. PnpDtpTerm
          5. Starting the Daytime Session
            1. PnpDtpRun
            2. PrvDtpCliOpen
            3. PrvDtpSvrOpen
            4. PnpNetSocketBind
          6. Stopping the Daytime Session
            1. PnpDtpStop
            2. PrvDtpCliClose
            3. PrvDtpSvrClose
          7. Processing Daytime Events
            1. PnpDtpProcess
            2. PnpDtpIsRunning
            3. PrvDtpSelect
            4. PrvDtpCliSend
            5. PrvDtpCliReceive
            6. PrvDtpSvrReceive
            7. PrvDtpSvrSend
            8. PnpNetSocketReceiveFrom
            9. PnpNetSocketSendTo
        5. Summary
    4. 14. Suggestions for Further Reading
    5. Index
    6. Colophon

Product information

  • Title: Palm OS Network Programming
  • Author(s):
  • Release date: September 2001
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596000059