TCP/IP Communications

Now it is time to look at TCP/IP. In this section, we will do the following:

  • Discuss the API for networking on a Palm device

  • Give you some programming tips for using TCP/IP

  • Use TCP/IP in a small sample application that sends email to a Simple Mail Transfer Protocol (SMTP) server

Network API

The Palm OS (2.0 or later) contains a net library that provides network services, such as TCP/IP, to applications. With this library, an application on the Palm device can connect to any other machine on a network using standard TCP/IP protocols. The API for this library is a socket interface modeled closely on the Berkeley Sockets API.


This section provides a brief introduction to network programming on the Palm OS. For more in-depth coverage, see Palm OS Network Programming, by Greg Winton (O’Reilly).

Berkeley Sockets API

Sockets are a communication mechanism. Information is sent into a socket on one machine and comes out of a socket on a remote machine (and vice versa). With a connection-oriented socket interface, you can establish the connection between the two machines prior to sending data. The connection stay opens whether or not data is sent. A good example of this is TCP. Sockets also allow a connectionless mode for sending datagrams. These can be sent to an address without any prior connection using a protocol such as the User Datagram Protocol (UDP).


For a brief introduction to Berkeley Sockets and socket programming, see ...

Get Palm OS Programming, 2nd Edition 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.