The TCP service model includes a connection-oriented service and a reliable data
transfer service. When an application invokes TCP as its transport protocol, the
application receives both of these services from TCP.
• Connection-oriented service. TCP has the client and server exchange transportlayer
control information with each other before the application-level messages
begin to flow. This so-called handshaking procedure alerts the client and server,
allowing them to prepare for an onslaught of packets. After the handshaking phase,
a TCP connection is said to exist between the sockets of the two processes. The
connection is a full-duplex connection in that the two processes can send messages
to each other over the connection at the same time. When the application finishes
sending messages, it must tear down the connection. In Chapter 3 we’ll discuss
connection-oriented service in detail and examine how it is implemented.
94 CHAPTER 2 • APPLICATION LAYER
SECURING TCP
Neither TCP nor UDP provide any encryption—the data that the sending process passes
into its socket is the same data that travels over the network to the destination
process. So, for example, if the sending process sends a password in cleartext (i.e.,
unencrypted) into its socket, the cleartext password will travel over all the links between
sender and receiver, potentially getting sniffed and discovered at any of the intervening
links. Because privacy and other security issues have become critical for many applications,
the Internet community has developed an enhancement for TCP, called Secure
Sockets Layer (SSL). TCP-enhanced-with-SSL not only does everything that traditional
TCP does but also provides critical process-to-process security services, including
encryption, data integrity, and end-point authentication. We emphasize that SSL is not
a third Internet transport protocol, on the same level as TCP and UDP, but instead is an
enhancement of TCP, with the enhancements being implemented in the application
layer. In particular, if an application wants to use the services of SSL, it needs to
include SSL code (existing, highly optimized libraries and classes) in both the client and
server sides of the application. SSL has its own socket API that is similar to the traditional
TCP socket API. When an application uses SSL, the sending process passes cleartext
data to the SSL socket; SSL in the sending host then encrypts the data and passes the
encrypted data to the TCP socket. The encrypted data travels over the Internet to the
TCP socket in the receiving process. The receiving socket passes the encrypted data to
SSL, which decrypts the data. Finally, SSL passes the cleartext data through its SSL
socket to the receiving process. We’ll cover SSL in some detail in Chapter 8.