Transport-Layer Protocols
Chapter 24
Introduction
Each protocol provides a different type of service:
UDP (User Datagram Protocol)
• unreliable connectionless TL protocol
– simplicity and efficiency in applications where error control can be
provided by the application-layer process
TCP (Transmission Control Protocol)
• reliable connection-oriented protocol
– used in any application where reliability is important
SCTP (Stream Control Transmission Protocol)
• SCTP is a new TL protocol
– combines the features of UDP and TCP
Some well-known ports used with UDP and TCP
Allow multiplexing and demultiplexing at this layer
24.2 USER DATAGRAM PROTOCOL
• Connectionless, unreliable transport protocol
• process-to-process communication instead of
host-to-host communication
• minimum of overhead
• If a process wants to send a small message and
does not care much about reliability
– it can use UDP
User Datagram
• UDP packets, called user datagrams,
– fixed-size header of 8 bytes made of four fields
UDP Services
1. Process-to-process communication
– UDP provides process-to-process communication using
socket addresses
• a combination of IP addresses and port numbers
2. Connectionless Services
– no relationship between the different user datagrams
• even if they are coming from the same source process
• going to the same destination program
– user datagrams are not numbered
– there is no connection establishment and no connection
termination
– processes sending short messages, messages less than
65,507 bytes (65,535 – 8 (UDP) -20 (IP)) can use UDP
3. Flow Control
• simple protocol, no flow control, and
– hence no window mechanism
– receiver may overflow with incoming messages
4. Error Control
• no error control mechanism in UDP except for the checksum
– sender does not know if a message has been lost or duplicated
– Receiver discards the user datagram if corrupted
5. Checksum
• Can choose not to be used
6. Congestion Control
• does not provide congestion control
• Assume packets sent are small and cannot create congestion in the
network.
– This assumption may or may not be true for interactive real-time transfer of audio
and video
7. Queuing
• At the client site, when a process starts,
– it requests a port number from OS
– Some implementations create both an incoming and an
outgoing queue associated with each process.
– Other create only an incoming queue
8. Multiplexing and Demultiplexing
– possibly several processes that may want to use the services
of UDP
• UDP is the connectionless simple protocol
– an optional checksum added to packets for error detection
UDP Applications
1. Connectionless Service
– Advantage
• if a client application needs to send a short request to a
server and
• to receive a short response
• In the connection-oriented service
– at least 9 packets are exchanged between the client and
the server [more delay]
– In connectionless service only 2 packets are exchanged
[less delay]
– Ex. DNS uses the services of UDP (short messages)
– SMTP cannot use UDP (long messages)
2. Lack of Error Control
• UDP does not provide error control
– it provides an unreliable service
– Ex. Skype: audio and video are divided into frames
• Uses UDP
– Downloading a file: cannot use UDP
3. Lack of Congestion Control
• UDP does not create additional traffic
Typical Applications:
• simple request-response communication
– little concern for flow and error control
– Not used for FTP
• suitable for a process with internal flow- and error-control mechanisms
– the Trivial File Transfer Protocol (TFTP)
• Suitable for multicasting
– not in the TCP software
• used for management processes such as SNMP
• used for some route updating protocols such as Routing Information Protocol (RIP)
• used for interactive real-time applications that cannot tolerate uneven delay
24.3 TRANSMISSION CONTROL PROTOCOL
• Connection-oriented, reliable protocol
• TCP explicitly defines
– connection establishment,
– data transfer, and
– connection teardown phase
• TCP uses a combination of
– GBN and
– SR protocols to provide reliability
• TCP uses checksum (for error detection),
– retransmission of lost or corrupted packets,
– cumulative and selective acknowledgments, and
– timers
TCP Services
1. Process-to-process Communication
2. Stream Delivery Service
– TCP, unlike UDP, is a stream-oriented protocol
• TCP allows the sending process to deliver data as a
stream of bytes and
– allows the receiving process to obtain data as a stream of
bytes.
• TCP creates an imaginary “tube” that carries their bytes
across the Internet.
3. Sending and Receiving Buffers
• sending and the receiving processes
– may not necessarily write or read data at the same
rate
– TCP needs buffers for storage
4. Segments
• The network layer service provider for TCP
– needs to send data in packets,
• not as a stream of bytes.
– TCP groups a number of bytes together into a packet
called a segment
5. Full-Duplex Communication
– segments move in both directions
6. Multiplexing and Demultiplexing
– Like UDP, TCP performs multiplexing at the sender and demultiplexing
at the receiver
7. Connection-Oriented Services
1. The two TCP’s establish a logical connection between them
2. Data are exchanged in both directions
3. The connection is terminated
8. Reliable Services
– TCP is a reliable transport protocol
– Acknowledgment mechanism to check the safe and sound arrival of
data
– error control
24.3.2 TCP Features
1. Numbering System
• No segment number in the segment header
• Two fields refer to byte number
– Sequence number and Ack number
• Byte number:
– TCP numbers all data bytes (no need to start with 0)
– Numbering is independent in each direction
– Sequence number
• sequence number of the first segment is the ISN (initial sequence number),
which is a random number
• any other segment’s sequence number +1 to the previous segment
– Ack number
• TCP is full duplex
• acknowledgment number defines the next byte that expects to receive
• acknowledgment number is cumulative
24.3.3 Segment
• Segment consists of a header of 20 to 60 bytes
• The header is 20 bytes if there are no options and
– up to 60 bytes if it contains options
• Source and Destination port number: 16 bit fields
• Sequence number: 32 bit field
– TCP is a stream oriented protocol
• Ack number: 32 bit field
– Return x+1 if x byte no. is received
• Header length: 4 bit field
• Control:
• Window size:
– value is normally referred to as the receiving window (rwnd) and is determined by the
receiver
• Checksum: is mandatory
• Urgent pointer: field bit is set if data is urgent
• Options: 40 bytes optional information
24.3.4 A TCP connection
• TCP is connection-oriented (logical path)
– IP is unaware of the retransmission
– IP is unaware of reordering
• Requires three phases:
1. connection establishment,
2. data transfer, and
3. connection termination
1. Connection Establishment:
– Three-way Handshaking
• Client want to make a connection with server using TCP
• Process starts with the server.
– tells its TCP that it is ready to accept a connection
– Request is called a passive open
• Client program issues a request for an active
open
• TCP can now start the three-way handshaking
process
• A SYN segment cannot carry data, but it consumes one sequence number
• A SYN 1 ACK segment cannot carry data, but it does consume one sequence no.
• An ACK segment, if carrying no data, consumes no sequence number.
SYN Flooding Attack:
• Malicious attackers send a large number of SYN segments to a
server by faking the source IP addresses
– Server allocated resources
– TCP server sends the SYN + ACK segments to the fake clients, which are
lost
– server waits for the third leg
• SYN flooding attack belongs to a group of security attacks
– denial of service attack
• TCP have strategies to alleviate the effect of a SYN attack
– imposed a limit requests during a specified period of time.
– filter out datagrams coming from unwanted source addresses
–
– postpone resource allocation by using a cookie
– SCTP uses this strategy
Data Transfer:
• After connection is established, bidirectional data transfer can take place
• acknowledgment is piggybacked with the data
Pushing Data:
• Delayed transmission and delayed delivery of data may not be
acceptable by the AP
• sending TCP set the push bit
– receiving TCP know that must be delivered to AP as soon as possible
• It changes the byte-oriented TCP to a chunk-oriented TCP
– but TCP can choose whether or not to use this feature
Urgent Data:
• sending AP tells the sending TCP that the piece of data is
urgent
• sending TCP creates a segment and inserts the urgent data at
the beginning of the segment
• If segment seq no. is 15000 and the value of the urgent pointer
is 200,
– first byte of urgent data is the byte 15000 and
– last byte is the byte 15200
Connection Termination:
• Either of the two parties can close the connection
– usually initiated by the client.
• Three-way handshaking
– The FIN segment consumes one sequence number if it does not carry
data
– FIN + ACK segment consumes only one sequence number if it does not
carry data
Connection Reset
• TCP at one end may
– deny a connection request,
– abort an existing connection, or
– terminate an idle connection.
• done with the RST (reset) flag.
Four-way handshaking with a half-close option