3.2 Multiplexing and De-multiplexingtransport-layer multiplexing and demultiplexing
transport-layer multiplexing requires
(1) that sockets have unique identifiers, and (2) that each segment have special fields that indicate the socket to which the segment is to be delivered.
what is the format of a port number?
Each port number is a 16-bit number, ranging from 0 to 65535. The port numbers ranging from 0 to 1023 are called well-known port num- bers and are restricted, which means that they are reserved for use by well-known application protocols such as HTTP (which uses port number 80) and FTP (which uses port number 21).
how does UDP demultiplex a segment?
Each socket in the host could be assigned a port number, and when a seg- ment arrives at the host, the transport layer examines the destination port number in the segment and directs the segment to the corresponding socket. The segment's data then passes through the socket into the attached process. As we'll see, this is basi- cally how UDP does it.
One subtle difference between a TCP socket and a UDP socket
TCP socket is identified by a four-tuple: (source IP address, source port number, destination IP address, destination port number). Thus, when a TCP segment arrives from the network to a host, the host uses all four values to direct (demultiplex) the segment to the appropriate socket.
multiplexing
The job of gathering data chunks at the source host from different sockets, encapsulating each data chunk with header information (that will later be used in demultiplexing) to create segments, and passing the segments to the network layer is called multiplexing.
what does the transport layer in the destination host do with the data it receives?
The transport layer has the responsibility of delivering the data in these segments to the appropriate application process running in the host.
demultiplexing
This job of delivering the data in a transport-layer segment to the correct socket
when you develop a new application, what do you need to assign it?
a port number
The TCP client creates a socket and sends a connection establishment request segment with the lines:
clientSocket = socket(AF_INET, SOCK_STREAM) clientSocket.connect((serverName,12000))
When the host operating system of the computer running the server process receives the incoming connection-request segment with destination port 12000, it locates the server process that is waiting to accept a connection on port num- ber 12000. The server process then creates a new socket:
connectionSocket, add = serverSocket.accept()
sockets
doors through which data passes from the network to the process and through which data passes from the process to the network.
source port number field and the destination port number field
each segment have special fields that indicate the socket to which the segment is to be delivered.
transport-layer multiplexing and demultiplexing
extending the host-to-host delivery service provided by the network layer to a process-to-process delivery service for applications running on the hosts.
how does the transport layer deliver data to a process
the transport layer in the receiving host does not actually deliver data directly to a process, but instead to an intermediary socket. Because at any given time there can be more than one socket in the receiving host, each socket has a unique identifier. The format of the identifier depends on whether the socket is a UDP or a TCP socket,
in the destination host how does the data enter
the transport layer receives segments from the network layer just below.