0% found this document useful (0 votes)
68 views

Computer Networks Unit 6

This document provides information on the transport and application layers. It discusses the key services of the transport layer including process-to-process delivery using port addresses, multiplexing, demultiplexing, and connection-oriented vs connectionless services. UDP and TCP are described as the main transport layer protocols, with UDP being connectionless and TCP providing reliable, connection-oriented delivery. TCP segments data into streams and provides buffers. The application layer focuses on HTTP and the client-server model used by web browsers and servers.

Uploaded by

ssabinayaa12
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Computer Networks Unit 6

This document provides information on the transport and application layers. It discusses the key services of the transport layer including process-to-process delivery using port addresses, multiplexing, demultiplexing, and connection-oriented vs connectionless services. UDP and TCP are described as the main transport layer protocols, with UDP being connectionless and TCP providing reliable, connection-oriented delivery. TCP segments data into streams and provides buffers. The application layer focuses on HTTP and the client-server model used by web browsers and servers.

Uploaded by

ssabinayaa12
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

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".

Figure: Process-To-Process Delivery

 Two processes communicate in a client/server relationship.


 Client-Server Paradigm:
o A process on the local host, called a client, needs services from a process usually on
the remote host, called a server.
 Addressing:
 The address at transport layer is called " Service-Point address" or " Port Address". If the
network model is OSI, then it is called " Service- Point address". If the network model is TCP/IP
it is called " Port Address".
 The port numbers are 16-bit integers between 0 and 65,535.
 The client program defines itself with a port number, chosen randomly by the transport layer
software running on the client host. This is the Ephemeral Port Number.

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".

Figure: Port Addresses

Figure: Relation Between IP address and Port address

 IANA Ranges of Port Numbers:


o The lANA (Internet Assigned Number Authority) has divided the port numbers into
three ranges: well known, registered, and dynamic (or private), as shown in Figure.

Figure: IANA ranges for Port numbers.


o Well-known ports: The ports ranging from 0 to 1023 are assigned and controlled by
IANA. These are the well-known ports.
o Registered ports: The ports ranging from 1024 to 49,151 are not assigned or
controlled by IANA. They can only be registered with lANA to prevent duplication.
o Dynamic ports: The ports ranging from 49,152 to 65,535 are neither controlled nor
registered. They can be used by any process. These are the ephemeral ports.
 Socket Address: Process-to-process delivery needs two identifiers, IP address and the port
number, at each end to make a connection. The combination of an IP address and a port
number is called a Socket Address.
 A transport layer protocol needs a pair of socket addresses: the client socket address and the
server socket address.

2|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

Figure: Socket Address

 Multiplexing and Demultiplexing:

Figure: Multiplexing and Demultiplexing in Transport 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.

 Connectionless Versus Connection-Oriented Service:

 A transport layer protocol can either be connectionless or connection-oriented.


 Connectionless Service: In a connectionless service, the packets are sent from one party to
another with no need for connection establishment or connection release.
o The packets are not numbered
o The packets may be delayed or lost or may arrive out of sequence.
o There is no acknowledgment either.

Ex: UDP

 Connection Oriented Service: In a connection-oriented service, a connection is first


established between the sender and the receiver. Data are transferred. At the end, the
connection is released.

Ex: TCP and SCTP

3|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

UDP (User Datagram Protocol):


 The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol. It does
not add anything to the services of IP except to provide process-to process communication instead
of host-to-host communication.
 It performs very limited error checking.
 Well-Known Ports for UDP

Table: Well-known port numbers for UDP

 User Datagram:
 UDP packets, called user datagrams, have a fixed-size header of 8 bytes.

Figure: UDP Header

 The fields are as follows:


o Source port number: This is the port number used by the process running on the source
host. It is 16 bits long, which means that the port number can range from 0 to 65,535.
 If the source host is the client, the port number is an ephemeral port number.
 If the source host is the server, the port number, in most cases, is a well-known
port number.
o Destination port number: This is the port number used by the process running on the
destination host. It is also 16 bits long.
 If the destination host is the , the port number, in most cases, is a well-known
port number.

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).

TCP (Transmission Control Protocol):


 TCP is called a connection-oriented, reliable transport protocol. It adds connection-oriented and
reliability features to the services of IP.
 Services Provided by TCP:
 Besides to the transport layer services the TCP Protocol provide Stream Delivery Service and
Source and Destination Buffers
 Stream Delivery Service:
o TCP is a stream-oriented protocol.
o 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.
o TCP creates an environment in which the two processes seem to be connected by an
imaginary "tube" that carries their data across the Internet.
o The sending process produces (writes to) the stream of bytes, and the receiving
process consumes (reads from) them.

Figure: Stream Delivery


 Source and Destination Buffers:
o Sending and Receiving Buffers Because the sending and the receiving processes may
not write or read data at the same speed, TCP needs buffers for storage. There are
two buffers, the sending buffer and the receiving buffer, one for each direction.

Figure: Sending and Receiving Buffers


5|P ag e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

 Well Known Port numbers:

Figure: Well-Known Port Addresses for TCP


 TCP Segment Format:
 The segment consists of a 20- to 60-byte header, followed by data from the application
program.
 The header is 20 bytes if there are no options and up to 60 bytes if it contains options.

Figure: TCP Segment Format

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.

Figure: Description of the flags in Control field.

 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

TCP Connection Management:


 TCP is connection-oriented. A connection-oriented transport protocol establishes a virtual path
between the source and destination.
 All the segments belonging to a message are then sent over this virtual path.
 Using a single virtual pathway for the entire message facilitates the acknowledgment process as well
as retransmission of damaged or lost frames.
 The point is that a TCP connection is virtual, not physical. TCP operates at a higher level.
 TCP uses the services of IP to deliver individual segments to the receiver, but it controls the
connection itself.
 If a segment is lost or corrupted, it is retransmitted. Unlike TCP, IP is unaware of this retransmission.
 If a segment arrives out of order, TCP holds it until the missing segments arrive; IP is unaware of this
reordering.
 In TCP, connection-oriented transmission requires three phases:
o Connection Establishment,
o Data Transfer, and
o Connection Termination.
 Connection Establishment:
o TCP transmits data in full-duplex mode. When two TCPs in two machines are connected, they
are able to send segments to each other simultaneously.
o This implies that each party must initialize communication and get approval from the other
party before any data are transferred.
o Three-Way Handshaking:
 The connection establishment in TCP is called three-way handshaking.
 An application program, called the client, wants to make a connection with another
application program, called the server, using TCP as the transport layer protocol.
 The process starts with the server. The server program tells its TCP that it is ready to
accept a connection. This is called a request for a passive open. Although the server.
 TCP is ready to accept any connection from any machine in the world, it cannot make
the connection itself. The client program issues a request for an active open.
 A client that wishes to connect to an open server tells its TCP that it needs to be
connected to that particular server.
 TCP can now start the three-way handshaking process as shown in Figure.
 Each segment has values for all its header fields and perhaps for some of its option
fields, too.
 SYN: The client sends the first segment, a SYN segment, in which only the SYN flag is set. This segment
is for synchronization of sequence numbers. It consumes one sequence number. When the data
transfer starts, the sequence number is incremented by 1. The SYN segment carries no real data.
 SYN+ACK: The server sends the second segment, a SYN +ACK segment, with 2 flag bits set: SYN and
ACK. This segment has a dual purpose. It is a SYN segment for communication in the other direction
and serves as the acknowledgment for the SYN segment. It consumes one sequence number.
 ACK: The client sends the third segment. This is just an ACK segment. It acknowledges the receipt of
the second segment with the ACK flag and acknowledgment number field. Note that the sequence

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.

Figure: TCP Connection Establishment

 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.

Figure: TCP Data transfer

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.

Figure: TCP Connection Termination

10 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

APPLICATION LAYER:

WWW (WORLD WIDE WEB):

Figure: Architecture of WWW

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 (Hyper Text Transfer Protocol):

HTTP Transaction:

13 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

Figure: Request Line

Figure: Status Line

14 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

15 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

Figure: Header Format

Table: Request Headers

16 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

17 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

WAP (Wireless Application Protocol):


 Wireless Application Protocol (WAP) is a technical standard for accessing information over a
mobile wireless network.
 A WAP browser is a web browser for mobile devices such as mobile phones that uses the protocol.
Introduced with much hype in 1999, WAP achieved some popularity in the early 2000s, but by the
2010s it had been largely superseded by more modern standards.
 Most modern handset internet browsers now fully support HTML, so they do not need to use WAP
markup for web page compatibility, and therefore, most are no longer able to render and display
pages written in WAP.
 WAP architecture:
 The following figure shows the basic WAP architecture. There are three participating entities: the
WAP browser, the WAP gateway (also called WAP proxy) and a server on the Internet.

Figure: WAP Architecture


 When the mobile device wants to connect to the Internet, all the communication passes through
the WAP gateway. This WAP gateway translates all the protocols used in WAP to the protocols
used on the Internet.
 For example, the WAP proxy encodes (and decodes) the content to reduce the size of the data
that has been sent over the wireless link.
 Another example is the WTLS protocol. The communication between the mobile device and the
WAP gateway is secured with WTLS. WTLS is only used between the mobile device and the WAP
gateway, while SSL/TLS can be used between the gateway and the Internet.
 This means that the WAP gateway first has to decrypt the encrypted WTLS-traffic and then has
to encrypt it again (using SSL/TLS).

Figure: WTLS-traffic gets translated to SSL/TLS-traffic


 WAP protocol stack:
 Many years ago, a theoretical protocol stack was developed by the OSI (Open Systems
Initiative). This was done to facilitate a common understanding of the functionality provided
by a protocol stack and to facilitate comparisons between different vendor’s
implementations.
 The mapping of the WAP protocol stack to the OSI model is shown in figure.
 The WAP protocol stack contains the following elements
 Physical and Data Link Layer: In WAP, Point to Point Protocols (PPP) are used over one or
more Over-The-Air (OTA) bearer protocols.
 Network Layer: IP is the network layer of choice. However, not all wireless networks are
capable of transmitting IP. That is why SMS or some other non-packet network protocol can
be used.

18 | P a g e
COMPUTER NETWORKS TRANSPORT & APPLICATION LAYER

Figure: WAP protocol stack

 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

You might also like