written 8.5 years ago by |
The transport service is implemented by a transport protocol.
Addressing in TCP and UDP
A typical host has many application processes running on it. These processes generate data that is sent to either TCP or UDP, which in turn passes it to IP for transmission. This multiplexed stream of datagrams is sent out by the IP layer to various destinations.
Similarly, a device’s IP layer receives datagrams, these datagrams need to be de-multiplexed, so they end up at the correct process on the device that receives them.
Multiplexing and De-multiplexing Using Ports:
The question is: How do we de-multiplex a sequence of IP datagrams that need to go to different application processes on the same host? Let’s consider a particular host bearing the IP address 24.156.79.20. How does the IP layer know which packet goes to which process on the same host?
The first part of the answer lies in the Protocol field included in the header of each IP datagram. This field carries a code that identifies the protocol that sent the data. Since most end-user applications use TCP or UDP at the transport layer, the Protocol field in a received datagram tells IP to pass data to either TCP or UDP as appropriate.
But both TCP and UDP are used by many applications at once. This means TCP or UDP must figure out which process to send the data to. To make this possible, an additional addressing element is necessary. This transport layer address is called a port.
A port can also be called a TSAP (Transport Service Access Point). An IP address can also be called a NSAP (Network Service Access Point). Key Concept: TCP/IP transport layer addressing is accompanied using TCP and UDP ports. Each port number within a particular IP device identifies a particular application process.
Source Port and Destination Port Numbers:
In both UDP and TCP messages, two addressing fields appear, for a Source Port and a Destination Port. These are analogous to the fields for source address and destination address at
the IP level, but at a higher level of detail. While the source address and destination address at the IP level identify the source machine and the destination machine; The Source Port and a Destination Port identify the originating process on the source machine, and the destination process on the destination machine.TCP and UDP port numbers are 16-bits in length.
Summary of Port Numbers for Datagram Transmission and Reception: So, to summarize, here’s the basics of how transport-layer addressing (port addressing) works in TCP and UDP:
a) Sending Datagrams: An application specifies the source and destination port it wishes to use for the communication. These are encoded into the TCP or UDP header, depending on which transport layer protocol the application is using. When TCP or UDP passes data to IP, IP indicates the protocol type (TCP or UDP) in the Protocol field of the IP datagram. The source and destination port numbers are encapsulated as part of the TCP or UDP message, Within the IP datagram’s data area.
b) Receiving Datagrams: The IP software receives the datagram, inspects the Protocol field and decides to which protocol the datagram belongs (TCP or UDP). TCP or UDP receives the datagram and passes its contents to the appropriate process based on the destination port number.
FLOW CONTROL and BUFFERING
1.Buffering
a) Sender:
i. In case of an unreliable network service the sending transport entity must buffer all TPDU’s as it might need to retransmit them.
ii. In case of a reliable network service the sender may/may not buffer outgoing TPDU’s.
b) Receiver:
i. If all TPDU’s are of same size, there will be a pool of identically sized buffers (one TPDU per buffer).
ii. If there is a wide variation in the TPDU sizes, variable sized buffer are used.
iii. Another option is to dedicate a single large buffer per connection.
2.Dynamic Buffer Management
In cases where traffic patterns change, the sender and receiver need to dynamically adjust their buffer allocations.
Working:
a) Sender requests receiver to allocate certain number of buffers to it.
b) The receiver depending on its load allocates as many buffers as possible.
c) When the sender sends a TPDU it decrements its allocation.
d) When the sender finishes its allocated quota it stops sending.
e) The receiver piggybacks acknowledgement and further buffer allocations on the reverse traffic. There might be a case where there are sufficient buffers at the sender and receiver but the subnet is congested. Therefore, along with buffering, flow control should also concentrate on the carrying capacity of the subnet.
3.Multiplexing
a) Upward Multiplexing:
If only one network address is available on a host all the transport connections on that machine use that single address. When a TPDU comes in, upward multiplexing is used to decide which process to give it to.
b) Downward Multiplexing:
Assume that a subnet uses virtual circuits internally and a maximum data rate is imposed on each one. If a user needs more bandwidth than what a single virtual circuit can provide, downward multiplexing can be used to open multiple network connection and distribute the traffic among them.