Unit-IV Transport Layer Protocols 4.1 User Datagram Protocol
Unit-IV Transport Layer Protocols 4.1 User Datagram Protocol
❑ Source port address. This is a 16-bit field that defines the port number of the
application program in the sender host.
❑ Destination port address. This is a 16-bit field that defines the port number of the
application program in the receiving host.
❑ Sequence number. This 32-bit field defines the number assigned to the first byte of data contained
in this segment.
❑ Acknowledgment number. This 32-bit field defines the byte number that the receiver of the
segment is expecting to receive from the other party. If the receiver of the segment has successfully
received byte number x from the other party, it returns x + 1 as the acknowledgment number.
Acknowledgment and data can be piggybacked together.
❑ Header length. This 4-bit field indicates the number of 4-byte words in the TCP header. The length
of the header can be between 20 and 60 bytes. i.e. 5 (5 × 4 = 20) and 15 (15 × 4 = 60).
❑ Control. This field defines 6 different control bits or flags. 1 URG: Urgent pointer is valid, 2 ACK:
Acknowledgment is valid, 3 PSH: Request for push, 4 RST: Reset the connection, 5 SYN: Synchronize
sequence numbers, 6 FIN: Terminate the connection
These bits enable flow control, connection establishment and termination, connection abortion, and
the mode of data transfer in TCP.
❑ Window size. This 16-bit field defines the window size of the sending TCP in bytes.
The maximum size of the window is 65,535 bytes.
❑ Checksum. This 16-bit field contains the checksum.
❑ Urgent pointer. This 16-bit field is valid only if the urgent flag is set. This field is
used when the segment contains urgent data.
The value of this field is added to the sequence number to get the byte number of the last urgent byte
in the data section of the segment.
❑ Options. There can be up to 40 bytes of optional information in the TCP header.
4.2.5 A TCP Connection
In TCP, connection-oriented transmission requires three phases: Connection Establishment,
Data Transfer, And Connection Termination.
Connection Establishment
The connection establishment in TCP is called three-way handshaking.
1. The client sends the first segment, a SYN segment.
• Set the SYN flag.
• The segment is used for synchronization of sequence number.
• This sequence number is called the initial sequence number (ISN).
• If client wants to define Maximum Segment Size (MSS), add MSS option.
• Does not define the window size.
• A SYN segment cannot carry data, but it consumes one sequence number.
2. The server sends a second segment, a SYN + ACK segment
• Set the SYN and ACK flag
• Acknowledge the receipt of the first segment using the ACK flag and acknowledgment number
field
o Acknowledgment number = client initialization sequence num+ 1
o Must also define the receiver window size for flow control
• SYN information for the server.
Initialization sequence number from server to client.
Window scale factor if used.
MSS is defined.
• A SYN + ACK segment cannot carry data, but does consume one sequence number.
3. The client sends the third segment, ACK segment.
• Acknowledge the receipt of second segment.
ACK flag is set.
Acknowledgement number = server initialization sequence number + 1
Must also define the server window size. Set the window size field.
The sequence number is the same as the one in the SYN segment
• In some implementation, data can be sent with the third packet.
Must have a new sequence number showing the byte number of the first byte in the data
• An ACK segment, if carrying no data, consumes no sequence number.
Figure: Half-close
4.2.6 State Transition Diagram
To keep track of all the different events happening during connection establishment, connection
termination, and data transfer, TCP is specified as the finite state machine
(FSM) as shown in Figure.
Figure: Options
End of Option (EOP)
The end-of-option (EOP) option is a 1-byte option used for padding at the end of the option section. It
can only be used as the last option. Only one occurrence of this option is allowed. After this option,
the receiver looks for the payload data.
No Operation (NOP)
The no-operation (NOP) option is a 1-byte option used as a filler. But it normally comes before another
option to help align it in a four-word slot.
Maximum Segment Size (MSS)
The maximum-segment-size option defines the size of the biggest unit of data that can
be received by the destination of the TCP segment. It defines the maximum size of the data, not the
maximum size of the segment. Since the field is 16 bits long, the value can be 0 to 65,535 bytes.
Window Scale Factor
To increase the window size, a window scale factor is used. The new window size is determined by
following:
New window size = window size defined in the header × 2 window scale factor
Timestamp
This is a 10-byte option. The active open announces a timestamp in the connection request segment
(SYN segment). If it receives a timestamp in the next segment (SYN + ACK) from the other end, it is
allowed to use the timestamp; otherwise, it does not use it any more. The timestamp option has two
applications: it measures the round-trip time and prevents wrap around sequence numbers.
Measuring RTT Timestamp can be used to measure the round-trip time (RTT).
PAWS The timestamp option has another application, protection against wrapped
sequence numbers (PAWS).
SACK-Permitted [Selective Acknowledgment (SACK) ]
The SACK-permitted option of 2 bytes is used only during connection establishment.
The host that sends the SYN segment adds this option to show that it can support the SACK
option. If the other end, in its SYN + ACK segment, also includes this option, then the two ends can
use the SACK option during data transfer. The SACK-permitted option is not allowed during the data
transfer phase.
SACK Options
The SACK option is variable length. It is used during data transfer only if both ends agree.
The option includes a list for blocks arriving out of order. Each block occupies two 32-bit numbers
that define the beginning and the end of the blocks.
4.3 SCTP
Stream Control Transmission Protocol (SCTP) is a new transport-layer protocol designed to combine
some features of UDP and TCP in an effort to create a better protocol for multimedia communication.
4.3.1 SCTP Services
1. Process-to- Process communication
SCTP uses all important ports of TCP.
2. Multi- Stream Facility
SCTP provides multi-stream service to each connection, called as association. If one stream gets
blocked, then the other stream can deliver the data.
3. Multihoming
Multihoming allows both ends (sender and receiver) to define multiple IP addresses for
communication. But, only one of these can be defined as primary address and the remaining can be
used as alternative addresses.
4. Full- Duplex Communication
SCTP provides full-duplex service (the data can flow in both directions at the same time).
5. Connection- Oriented Service
The SCTP is a connection-oriented protocol, just like TCP with the only difference that, it is
called association in SCTP. If User1 wants to send and receive message from user2, the steps are:
Step1: The two SCTPs establish the connection with each other.
Step2: Once the connection is established, the data gets exchanged in both the directions.
Step3: Finally, the association is terminated.
6. Reliability
SCTP uses an acknowledgement mechanism to check the arrival of data.
4.3.2 SCTP Features
1. Transmission Sequence Number (TSN)
The unit of data in SCTP is a data chunk. Data transfer in SCTP is controlled by numbering the data
chunks. In SCTP, TSN is used to assign the numbers to different data chunks.
2. Stream Identifier (SI)
The SI is a 16-bit number and starts with 0. In SCTP, there may be several streams in each
association. Each stream in SCTP needs to be identified using a stream identifier (SI). Each data
chunk needs to carry the SI in the header, so that it is properly placed in its stream on arrival.
3. Stream Sequence Number (SSN)
SCTP defines each data chunk in each stream with a stream sequence number (SSN). It is delivered
data chunk to the appropriate stream and in the proper order at the destination SCTP. This means that,
SSN in addition to a SI,
4. Packets
In SCTP, the data is carried out in the form of data chunks and control information is carried
as control chunks. Data chunks and control chunks are packed together in the packet.
5. Acknowledgment Number
SCTP acknowledgment numbers are chunk-oriented.
4.3.3 Packet Format
A SCTP packet contains a mandatory general header and a set of blocks called chunks. There are two
types of chunks: control chunks and data chunks. A control chunk controls and maintains the
association. A data chunk carries user data. In a packet, the control chunks come before the data
chunks. Figure shows the general format of a SCTP packet.
Table: Chunks
4.3.4 A SCTP Association
SCTP, like TCP, is a connection-oriented protocol. But, a connection in SCTP is called an association
to emphasize multihoming.
Association Establishment
The server must be prepared to accept an incoming association. This preparation is normally done by
calling socket, bind, and listen and is called a passive open.
Figure : Four-way handshaking
1 The client issues an active open by calling connect or by sending a message, which implicitly opens
the association. The client SCTP send an INIT message (which stands for "initialization") to the server,
which contains the client's list of IP addresses, initial sequence number, initiation tag to identify all
packets in this association, number of outbound streams the client is requesting, and number of inbound
streams the client can support.
2 The server acknowledges the client's INIT message with an INIT-ACK message, which contains the
server's list of IP addresses, initial sequence number, initiation tag, number of outbound streams the
server is requesting, number of inbound streams the server can support, and a state cookie. The state
cookie contains all of the state that the server needs to ensure that the association is valid, and is
digitally signed to ensure its validity.
3 The client echos the server's state cookie with a COOKIE-ECHO message. This message may also
contain user data bundled within the same packet.
4 The server acknowledges that the cookie was correct and that the association was established with a
COOKIE-ACK message. This message may also contain user data bundled within the same packet.
The minimum number of packets required for this exchange is four; hence, this process is called
SCTP's four-way handshake.
Data Transfer
The purpose of an association is to transfer data between two ends. After the
association is established, bidirectional data transfer can take place. The client and the
server can both send data. SCTP supports piggybacking.
A message received from a process becomes a DATA chunk, or chunks if fragmented, by adding a
DATA chunk header to the message. Each DATA chunk formed by a message or a fragment of a
message has one TSN. Only DATA chunks use TSNs and only DATA chunks are acknowledged by
SACK chunks.
Multihoming Data Transfer
Multihoming allows both ends to define multiple IP addresses for communication. But, only one of
these addresses can be defined as the primary address; the rest are alternative addresses.
Data transfer uses the primary address of the destination. If the primary is not available, one of the
alternative addresses is used.
Multistream Delivery
SCTP uses TSN numbers to handle data transfer, movement of data chunks between the source and
destination. The delivery of the data chunks is controlled by SIs and SSNs.
SCTP can support multiple streams, which means that the sender process can define different streams
and a message can belong to one of these streams. Each stream is assigned a stream identifier (SI)
which uniquely defines that stream.
SCTP supports two types of data delivery in each stream: ordered (default) and unordered.
Fragmentation
SCTP preserves the boundaries of the message from process to process when creating a DATA chunk
from a message if the size of the message does not exceed the MTU of the path.
Association Termination
If one end closes the association, the other end must stop sending new data. If any data are left over in
the queue of the recipient of the termination request, they are sent and the association is closed.
Association termination uses three packets, as shown in Figure.
Figure: Association termination
4.3.5 Flow Control
SCTP handle two units of data: the byte and the chunk. The values of rwnd and cwnd are expressed in
bytes; the values of TSN and acknowledgments are expressed in chunks.
Receiver Site
The receiver has one buffer (queue) and three variables. The queue holds the received data chunks that
not read by the process. Three variables: 1. cumTSN holds the last TSN received. 2. winSize holds the
available buffer size. 3. lastACK holds the last cumulative acknowledgment, lastACK. Figure shows
the queue and variables at the receiver site.
5.1.2 HTTP
The Hyper Text Transfer Protocol (HTTP) is used to define how the client-server programs can be
written to retrieve web pages from the Web. An HTTP client sends a request; an HTTP server returns
a response. The server uses the port number 80; the client uses a temporary port number. HTTP uses
the services of TCP, which is a connection-oriented
and reliable protocol. This means that, before any transaction between the client and the server take
place, a connection needs to be established between them. After the transaction, the connection should
be terminated. The client and server do not need to worry about errors in messages exchanged or loss
of any message, because the TCP is reliable and will take care of this matter.
5.2 File Transfer: FTP and TFTP
5.2.1 FTP
FTP is a stranded mechanism provided by the Internet for copying a file from one host to the other.
• The Root Domain is at the top of the hierarchy and is represented by a period (.).
• Top-Level Domains are two or three-character name codes, representing organisation type or
geographic location, eg: .com, .gov, .edu, .uk, .es etc. Top-level domains can contain second-
level domains and host names.
• Second-Level Domains are registered to individuals and organisations for use on the Internet.
A second-level name has two name components: a top-level name and a unique second-level
name, eg: jaihind.edu.
• Subdomains are created when organisations extend their DNS tree to represent departments,
divisions, or other geographic locations. Subdomains have three name components: a top-level
name, a unique second-level name, and a unique name representing the department or location,
eg: admin.jaihind.edu
• Host names are the names of specific computers on the Internet or in a private network. A host
name is the leftmost portion of a fully qualified domain name (FQDN), which describes the
exact position of a host within the domain hierarchy. comp1.admin.jaihind.edu is a FQDN.
DNS uses a host's FQDN to resolve a name to an IP address. The host name does not have to
be the same as the computer name.
5.4.2 DNS Operation
a hostname se.sjsu.edu is requesting the IP address of mail.yahoo.com. the authoritative DNS server
for mail.yahoo.com is dns.yahoo.com. The way the DNS resolves the request is shown below.
The host se.sjsu.edu sends a DNS query to the local DNS server to translate the hostname
‘mail.yahoo.com’ to the IP address. In response, the local DNS server i.e. dns.sjsu.edu forwards the
query to the root DNS server. The root DNS server finds the suffix as ‘com’ and returns a list of IP
address of the top-level DNS server responsible for ‘com’. The local DNS server then sends the same
query to one of the top-level DNS servers which were provided by the root DNS server. The top-level
DNS server finds a suffix yahoo.com and returns the local DNS server with an IP address of the
authoritative DNS server for Yahoo i.e. yahoo.com. Finally, the local DNS server sends the same query
again to the authoritative DNS server dns.yahoo.com, which in turn responds with the IP address of
mail.yahoo.com.
5.5 DHCP
5.5.1 Static and Dynamic Allocation
Static Allocation
A static Internet Protocol (IP) address (static IP address) is a permanent number assigned to a computer
by an Internet service provider (ISP). Static IP addresses are useful for gaming, website hosting or
Voice over Internet Protocol (VoIP) services. Speed and reliability are key advantages. Because a static
address is constant, systems with static IP addresses are vulnerable to data mining and increased
security risks.
A static IP address is also known as a fixed address. This means that a computer with an assigned static
IP address uses the same IP address when connecting to the Internet.
Dynamic Allocation
A dynamic Internet Protocol address (dynamic IP address) is a temporary IP address that is assigned
to a computing device or node when it’s connected to a network. A dynamic IP address is an
automatically configured IP address assigned by a DHCP server to every new network node.
5.5.2 DHCP Operation
DHCP (Dynamic Host Configuration Protocol) is a client-server protocol that uses DHCP servers and
DHCP clients. A DHCP server is a machine that runs a service that can lease out IP addresses and
other TCP/IP information to any client that requests them. The DHCP server typically has a pool of IP
addresses that it is allowed to distribute to clients, and these clients lease an IP address from the pool
for a specific period of time, usually several days. Once the lease is ready to expire, the client contacts
the server to arrange for renewal. DHCP clients are client machines that run special DHCP client
software enabling them to communicate
with DHCP server.
DHCP clients obtain a DHCP lease for an IP address, a subnet mask, and various DHCP options from
DHCP servers in a four-step process:
DHCP DISCOVER: The client broadcasts a request for a DHCP server.
DHCPOFFER: DHCP servers on the network offer an address to the client.
DHCPREQUEST: The client broadcasts a request to lease an address from one of the offering DHCP
servers.
DHCPACK: The DHCP server that the client responds to acknowledges the client,
assigns it any configured DHCP options, and updates its DHCP database. The
client then initializes and binds its TCP/IP protocol stack and can begin network
communication.
5.6 Remote Login: TELNET and SSH.
5.6.1 TELNET
TELNET is abbreviation for Terminal Network. It is standard TCP/IP protocol for virtual terminal
services proposed by ISO. TELNET enables establishment of connection to a remote system in such a
way that a local terminal appears to be terminal at remote system. TELNET is general purpose client
server application program
Local Login When user log in to local time sharing system it is called local login. The keystrokes
accepted by terminal driver. Terminal driver passes the character to the operating system. Operating
system interprets the combination of character and invoke the desired application or utility.
Remote login When user wants to access the application or utility located at the remote machine, he
or she performs remote login. Here the telnet client and server program come into use. The user sends
the keystrokes to local operating system. local operating system accept it, but do not interpret them.
The characters are send to TELNET client. TELNET client transform the character to a universal
character set called Network Virtual Terminal Character and deliver them to the local TCP/IP stack.
As shown in above figure the command/text in NVT form travel through internet, and arrive at TCP/IP
stack of remote Machine. Here the characters are delivered to the operating system and Passed to the
TELNET server. Which changes the characters to the understandable characters by the remote
computer. But, characters could not directly pass to the operating system because remote operating
system is not designed to receive characters from TELNET server. The solution is to add piece of
software called Pseudo- terminal driver, which pretends that characters are coming from terminal. The
operating system passes the characters to appropriate application program.
5.6.2 SSH
Secure Shell (SSH) is a secure application program that can be used for several purposes such as
remote logging and file transfer, it was originally designed to replace TELNET. There are two versions
of SSH: SSH-1 and SSH-2.
SSH is an application-layer protocol with three components, as shown in Figure.
Figure: Components of SSH
1. SSH-TRANS
The Transport Layer Protocol provides server authentication, confidentiality, and integrity. It may
optionally also provide compression. The transport layer will typically be run over a TCP/IP
connection, but might also be used on top of any other reliable data stream.
2. SSH-AUTH
The User Authentication Protocol authenticates the client-side user to the server. It runs over the
transport layer protocol.
3. SSH-CONN
The Connection Protocol multiplexes the encrypted tunnel into several logical channels. It runs over
the user authentication protocol.