Summary

TCP provides sophisticated connection-oriented network access. The Sockets interface provides an API to the power of these TCP connections. The Palm OS Net Library supports an API adapted from the original sockets interface to meet the needs and constraints of the Palm OS networking environment.

A socket is an end-point on a connection between two processes on separate hosts. A socket must first be opened; this creates a Socket instance and allocates its resources. For Palm OS Networking, you use NetLibSocketOpen to open this socket.

The client attempts to connect to the server using the three-way handshake. The client sends a connection initiation segment to the server. The server responds with its own connection initiation segment and an acknowledgment of the client’s. The client then acknowledges the server’s connection initiation segment. This is all performed under the hood by the protocol stack; the network application simply calls NetLibSocketConnect to initiate the connection process.

When we are finished with a socket, it is time to dispose of it. At the TCP level, there are four steps to closing a socket. The initiator starts shutting down the socket and sends a connection termination segment to the remote host. The remote host’s protocol stack acknowledges this. But the remote process may not shut down its socket right away. Eventually, the remote process shuts down its socket, which results in a connection termination segment being sent back to the initiator. ...

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.