Summary
In this chapter, we explored the functions that allow Palm OS
networking applications to accept incoming connection requests.
NetLibSocketOpen opens a socket, for either
connecting or listening. NetLibSocketBind names
the socket. This is mostly used for listening sockets, especially
listening sockets that are bound to a specific port.
NetLibSocketListen sets the socket to the passive
listening mode. In this mode, the protocol stack accepts connection
requests addressed to this socket.
We also discussed the mechanics of retrieving a directory listing
from an FTP server. To achieve this, we needed to implement a data
connection on its own socket. The semantics of FTP require that the
FTP client act as the server on the data connection, accepting the
FTP server’s connection request. We extended
FtpView to support retrieving the server’s
directory listing.
Along the way, we encountered two limitations that make Palm OS devices relatively unsuited for the job of serving connections:
Only four sockets are allowed. This means that in addition to the listening socket, we can only have three additional sockets.
Listening supports queue length of one. Once a connection request is completed, the protocol stack denies all further requests until our application accepts the connection.
Palm OS devices do make excellent clients, however. And now that we’ve added data handling, we have everything we need to build a fully functional FTP client. We will leave it as an exercise for the reader ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access