background image
TCP/IP Protocols
219
telnetted to Curly. The socket used by the Telnet server on Curly consists of an IP address, the
transport layer protocol in use, and a port number--in this case, 10.1.1.3, TCP, 23. Because data
coming from both Telnet clients is sent to that socket, Curly cannot distinguish which client has
sent data to the Telnet server based on only Curly's socket. For the Telnet server to know which
connection the data is coming over, the combination of the socket at the server and the socket
at the client is used to uniquely identify connection. For example, Client 1 uses socket 10.1.1.1,
TCP, 1027; Client 2 uses socket 10.1.1.1, TCP, 1028. Now Curly can distinguish between the
two clients. So, TCP uses the socket connection between the two sockets to perform
multiplexing.
Figure 5-3
Connections Between Sockets
Port numbers are a vital part of the socket concept. Well-known port numbers are used by
servers; other port numbers are used by clients. Applications that provide a service, such as FTP,
Telnet, and Web servers, open a socket using a well-known port and listen for connection
requests. Because these connection requests from clients are required to include both the source
and the destination port numbers, the port numbers used by the servers must be well known.
Therefore, each server has a hard-coded well-known port number, as defined in the well-known
numbers RFC. On client machines, where the requests originate, any unused port number can
be allocated. The result is that each client on the same host uses a different port number, but a
server uses the same port number for all connections. For example, 100 Telnet clients on the
same host would each use a different port number, but the Telnet server, with 100 clients
connected to it, would have only one socket and therefore only one port number. The
combination of source and destination sockets allows all participating hosts to distinguish
the source and destination of the data. (Look to www.rfc-editor.org to find RFCs such as
the well-known numbers RFC 1700.)
Telnet
Client
#2
Larry
10.1.1.1
10.1.1.2
10.1.1.3
Telnet
Client
#1
FTP
Client
Moe
Web
Client
FTP
Server
Curly
Telnet
Server
Web
Server
ch05.fm Page 219 Monday, March 20, 2000 5:06 PM