Computer Networks Unit 6
Computer Networks Unit 6
UNIT-6
Transport Layer & Application Layer
Syllabus:
Transport Layer: Services provided to the upper layers, elements of transport protocol-addressing connection
establishment, connection release, Connection Release, Crash Recovery.
Application layer: (WWW and HTTP): ARCHITECTURE: Client (Browser), Server, Uniform Resource Locator HTTP:
HTTP Transaction, HTTP Operational Model and Client/Server Communication, HTTP Generic Message Format, HTTP
Request Message Format, HTTP Response Message Format The wireless web: WAP—The Wireless Application
Protocol
Transport layer:
Transport layer is the heart of the whole protocol hierarchy.
Transport layer task is to provide reliable, cost-effective data transport from the source machine to
the destination machine, independently of the physical network or networks currently in use.
Transport Layer Services:
Process-To-Process Delivery:
Several processes may be running on the source host and several on the destination host. To complete
the delivery, we need a mechanism to deliver data from one of these processes running on the source
host to the corresponding process running on the destination host. That mechanism is called "
Process- Process Delivery".
1|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
The server process must also define itself with a port number. This port number, cannot be
chosen randomly. This is called " Well-Known Port Number".
2|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
Multiplexing: At the sender site, there may be several processes that need to send packets.
However, there is only one transport layer protocol at any time. This is a many-to-one
relationship and requires multiplexing.
Demultiplexing: At the receiver site, the relationship is one-to-many and requires
Demultiplexing. The transport layer receives datagrams from the network layer. After error
checking and dropping of the header, the transport layer delivers each message to the
appropriate process based on the port number.
Ex: UDP
3|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
User Datagram:
UDP packets, called user datagrams, have a fixed-size header of 8 bytes.
4|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
If the destination host is the client, the port number, is an ephemeral port
number.
o Length: This is a 16-bit field that defines the total length of the user datagram, header
plus data. The 16 bits can define a total length of 0 to 65,535 bytes.
UDP length = IP length - IP header's length
o Checksum: This field is used to detect errors over the entire user datagram (header
plus data).
6|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
Source port address: This is a 16-bit field that defines the port number of the application
program in the host that is sending the segment.
Destination port address: This is a 16-bit field that defines the port number of the
application program in the host that is receiving the segment.
Sequence number: This 32-bit field defines the number assigned to the first byte of data
contained in this segment. TCP is a stream transport protocol. To ensure connectivity, each
byte to be transmitted is numbered. The sequence number tells the destination which byte
in this sequence comprises the first byte in the 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 defines 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. Therefore, the value of this field can
be between 5 (5 x 4 =20) and 15 (15 x 4 =60).
Reserved: This is a 6-bit field reserved for future use.
Control: This field defines 6 different control bits or flags. One or more of these bits can be
set at a time.
Window size: This field defines the size of the window, in bytes, that the other party must
maintain. This value is normally referred to as the receiving window (rwnd) and is determined
by the receiver. The sender must obey the dictation of the receiver in this case.
Checksum: This 16-bit field contains the checksum. This is used to detect errors in the header.
Urgent pointer: This l6-bit field, which is valid only if the urgent flag is set, is used when the
segment contains urgent data. It defines the number that must be added to the sequence
number to obtain the number of the last urgent byte in the data section of the segment. This
will be discussed later in this chapter.
Options: There can be up to 40 bytes of optional information in the TCP header.
7|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
8|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
number in this segment is the same as the one in the SYN segment; the ACK segment does not
consume any sequence numbers.
Data Transfer:
o After connection is established, bidirectional data transfer can take place.
o The client and server can both send data and acknowledgments.
o The acknowledgment is piggybacked with the data.
o The data segments sent by the client have the PSH (push) flag set so that the server TCP knows
to deliver data to the server process as soon as they are received.
o The segment from the server, on the other hand, does not set the push flag.
o TCP uses a buffer to store the stream of data coming from the sending application program.
o The sending TCP can select the segment size.
o The receiving TCP also buffers the data when they arrive and delivers them to the application
program when the application program is ready or when it is convenient for the receiving TCP.
o This type of flexibility increases the efficiency of TCP.
9|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
Connection termination:
o Any of the two parties involved in exchanging data (client or server) can close the connection,
although it is usually initiated by the client.
o TCP uses three-way handshaking for connection termination.
1. In a normal situation, the client TCP, after receiving a close command from the client
process, sends the first segment, a FIN segment in which the FIN flag is set. Note that
a FIN segment can include the last chunk of data sent by the client, or it can be just a
control segment.
2. The server TCP, after receiving the FIN segment, informs its process of the situation
and sends the second segment, a FIN +ACK segment, to confirm the receipt of the FIN
segment from the client and at the same time to announce the closing of the
connection in the other direction. This segment can also contain the last chunk of data
from the server. If it does not carry data, it consumes only one sequence number.
3. The client TCP sends the last segment, an ACK segment, to confirm the receipt of the
FIN segment from the TCP server. This segment contains the acknowledgment
number, which is 1 plus the sequence number received in the FIN segment from the
server. This segment cannot carry data and consumes no sequence numbers.
10 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
APPLICATION LAYER:
11 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
*****************
URL (UNIFORM RESOURCE LOCATOR):
12 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
*********************
HTTP Transaction:
13 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
14 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
15 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
16 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
17 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
18 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
Transport Layer: The protocol used in the transport layer is UDP. However, this may not be
feasible over non-IP networks. That is why (there are also other reasons) that WAP defines an
additional transport layer protocol, WDP, which can be used when UDP cannot.
Session Layer: The functionality of the session layer is partially included in WTP. Other aspects of
the functionality are implemented in WSP.
Presentation Layer: The functionality of the presentation layer is included in WSP.
Application Layer: Some aspects of the functionality of the application layer are included in WSP,
the others are implemented in WAE.
**************************
Crash Recovery in Transport Layer:
If hosts and routers are subject to crashes, recovery from these crashes becomes an issue.
If the transport entity is entirely within the hosts, recovery from network and router crashes is
straight forward.
If the network layer provides datagram service, the transport entities expect lost TPDUs all the time
and know how to cope (deal effectively with something difficult) with them.
If the network layer provides connection-oriented service, then loss of a virtual circuit is handled by
establishing a new one and then probing the remote transport entity to ask it which TPDUs it has
received and which ones it has not received.
In particular, it may be desirable for clients to be able to continue working when servers crash and
then quickly reboot.
No matter how the client and server are programmed, there are always situations where the
protocol fails to recover properly.
The server can be programmed in one of two ways:
acknowledge first
write first.
The client can be programmed in one of four ways:
always retransmit the last TPDU,
never retransmit the last TPDU,
retransmit only in state S0,
retransmit only in state S1
19 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER
This gives eight combinations, but as we shall see, for each combination there is some set of events
that makes the protocol fail.
Three events are possible at the server:
sending an acknowledgement
writing to the output process (W)
crashing (C).
The three events can occur in six different orderings: AC(W), AWC, C(AW), C(WA), WAC, and WC(A),
where the parentheses are used to indicate that neither A nor W can follow C (i.e., once it has
crashed, it has crashed).
Figure shows all eight combinations of client and server strategy and the valid event sequences for
each one.
Notice that for each strategy there is some sequence of events that causes the protocol to fail.
For example, if the client always retransmits, the AWC event will generate an undetected duplicate,
even though the other two events work properly.
********************************
20 | P a g e