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

m5

Uploaded by

aryananil00007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

m5

Uploaded by

aryananil00007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

BCS502 COMPUTER NETWORKS


Module-5: Application Layer
Ch. 25. Introduction to Application Layer: Introduction, Client-Server Programming
Ch. 26. Standard Client-Server Protocols: World Wide Web and HTTP, FTP, Electronic Mail, Domain
Name System (DNS), TELNET, Secure Shell (SSH).
Textbook: Ch. 25.1-25.2, 26.1-26.6
-----------------------------------------------------------------------------------------------------------------------------------------------------
Chapter 25: Introduction to Application Layer [P-854]
Introduction, Client-Server Programming
-----------------------------------------------------------------------------------------------------------------------------------------------------
Introduction to Application Layer
 The whole Internet, hardware and software, was designed and developed to provide services at the
application layer. The fifth layer of the TCP/IP protocol suite is where these services are provided
for Internet users. The other four layers are there to make these services possible.
 Communication is provided using a logical connection, which means that the two application layers
assume that there is an imaginary direct connection through which they can send and receive
messages. Figure shows the idea behind this logical connection.

Providing Services
 The Internet was originally designed for the purpose: to provide service to users around the
world. The layered architecture of the TCP/IP protocol suite, however, makes the Internet more
flexible than other communication networks such as postal or telephone networks.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -1-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

 Each layer in the suite was originally made up of one or more protocols, but new protocols can be
added or some protocols can be removed or replaced by the Internet authorities. However, if a
protocol is added to each layer, it should be designed in such a way that it uses the services
provided by one of the protocols at the lower layer. If a protocol is removed from a layer, care
should be taken to change the protocol at the next higher layer that supposedly uses the services
of the removed protocol.
 The application layer is different from other layers in that it is the highest layer in the suite. The
protocols in this layer do not provide services to any other protocol in the suite; they only receive
services from the protocols in the transport layer. This means that protocols can be removed from
this layer easily. New protocols can be also added to this layer as long as the new protocols can use
the services provided by one of the transport-layer protocols.
 Since the application layer is the only layer that provides services to the Internet user, the flexibility
of the application layer allows new application protocols to be easily added to the Internet, which
has been occurring during the lifetime of the Internet. When the Internet was created, only a few
application protocols were available to the users; today we cannot give a number for these
protocols because new ones are being added constantly.
Standard Application-Layer Protocols
 There are several application-layer protocols that have been standardized and documented by the
Internet authority, and we are using them in our daily interaction with the Internet. Each standard
protocol is a pair of computer programs that interact with the user and the transport layer to
provide a specific service to the user.
 In the case of these application protocols, we should know what types of services they provide,
how they work, and the options that we can use with these applications, and so on.
 The study of these protocols enables a network manager to easily solve the problems that may
occur when using these protocols. The deep understanding of how these protocols work will also
give us some ideas about how to create new nonstandard protocols.
Nonstandard Application-Layer Protocols
 A programmer can create a nonstandard application-layer program if you can write two programs
that provide service to the user by interacting with the transport layer.
 It is the creation of a nonstandard (proprietary) protocol, which does not even need the approval of
the Internet authorities if privately used, that has made the Internet so popular worldwide.
 A private company can create a new customized application protocol to communicate with all of its
offices around the world using the services provided by the first four layers of the TCP/IP protocol
suite without using any of the standard application programs.
 What is needed is to write programs, in one of the computer languages that use the available
services provided by the transport-layer protocols.
Application-Layer Paradigms
 To use the Internet we need two application programs to interact with each other
o one running on a computer somewhere in the world
o the other running on another computer somewhere else in the world.
 The two programs need to send messages to each other through the Internet infrastructure.
 Two paradigms have been developed during the lifetime of the Internet:
o the client-server paradigm
o the peer-to-peer paradigm.
Traditional Paradigm: Client-Server
 The traditional paradigm is called the client-server paradigm. In this paradigm, the service provider
is an application program, called the server process; it runs continuously, waiting for another

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -2-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

application program,, called the client process, to make a connection through the Internet and ask
for service.
 There are normally some server processe
processess that can provide a specific type of service, but there are
many clients that request service from any of these server processes. The server process must be
running all the time; the client process is started when the client needs to receive service
service.
 Although the
communication in the
client-server paradigm is
between two application
programs, the role of each
program is totally different.
In other words, we cannot
run a client program as a
server program or vice
versa.
 Figure shows an example of
a client-server
communication in which three clients communicate with one server to receive the services
provided by this server.
 One problem with this paradigm is that the concentration of the communication load is on the
server,, which means the server should be a powerful computer. Even a powerful computer may
become overwhelmed if a large number of clients try to connect to the server at the same time.
 Another problem is that there should be a service provider willing to accept the cost and create a
powerful server for a specific service
service,, which means the service must always return some type of
income for the server in order to encourage such an arrangement. Several traditional services are
still using this paradigm, including the World Wide Web (WWW) and its vehicle ehicle HyperText Transfer
Protocol (HTTP), file transfer protocol (FTP), secure shell (SSH), ee-mail,, and so on.
New Paradigm: Peer-to-Peer
 A new paradigm, called the peer
peer-to-peer paradigm (P2P paradigm) has emerged to respond to the
needs of some new
applications. In this
paradigm, there is no
need for a server process
to be running all the time
and waiting for the client
processes to connect. The
responsibility is shared
between peers. A
computer connected to
the Internet can provide
service at one time and
receive service at another
time. A computer can even provide and receive se services
rvices at the same time. Figure shows an example
of communication in this paradigm.
 One of the areas that really fits in this paradigm is the Internet telephony. Communication by
phone is indeed a peer-to-peer
peer activity; no party needs to be running forever waiting for the other
party to call. Another area in which the peer peer-to-peer
peer paradigm can be used is when some
computers connected to the Internet have something to share with ea each
ch other

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -3-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

 Although the peer-to-peer paradigm has been proved to be easily scalable and cost-effective in
eliminating the need for expensive servers to be running and maintained all the time, there are
also some challenges.
 The main challenge has been security; it is more difficult to create secure communication between
distributed services than between those controlled by some dedicated servers.
 The other challenge is applicability; it appears that not all applications can use this new paradigm.
For example, not many Internet users are ready to become involved, if one day the Web can be
implemented as a peer-to-peer service. There are some new applications, such as BitTorrent,
Skype, IPTV, and Internet telephony that use this paradigm.
Mixed Paradigm
 An application may choose to use a mixture of the two paradigms by combining the advantages of
both.
 For example, a light-load client-server communication can be used to find the address of the peer
that can offer a service. When the address of the peer is found, the actual service can be received
from the peer by using the peer-topeer paradigm.
-----------------------------------------------------------------------------------------------------------------------------------------------------
CLIENT-SERVER PROGRAMMING
Topics covered
 Application Programming Interface
 Using Services of the Transport Layer
 Iterative Communication Using UDP
 Iterative Communication Using TCP
 Concurrent Communication
-----------------------------------------------------------------------------------------------------------------------------
 In a client-server paradigm, communication at the application layer is between two running
application programs called processes: a client and a server.
 A client is a running program that initializes the communication by sending a request; a server is
another application program that waits for a request from a client.
 The server handles the request received from a client, prepares a result, and sends the result back
to the client. This definition of a server implies that a server must be running when a request from
a client arrives, but the client needs to be run only when it is needed.
 We need to be careful that the server program is started before we start running the client
program. The lifetime of a server is infinite: it should be started and run forever, waiting for the
clients.
 The lifetime of a client is finite: it normally sends a finite number of requests to the corresponding
server, receives the responses, and stops.
Application Programming Interface
(Sockets - Socket Addresses - Finding Socket Addresses - Server Site - Client Site)
How can a client process communicate with a server process?
 If we need a process to be able to communicate with another process, we need a new set of
instructions to tell the lowest four layers of the TCP/IP suite to open the connection, send and
receive data from the other end, and close the connection. A set of instructions of this kind is
normally referred to as an application programming interface (API).
 An interface in programming is a set of instructions between two entities. In this case, one of the
entities is the process at the application layer and the other is the operating system that
encapsulates the first four layers of the TCP/IP protocol suite.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -4-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 A computer manufacturer needs to build the first four layers of the suite in the operating system
and include an API.. In this way, the process
processes
es running at the application layer are able to
communicate with the operating system when sending and receiving messages through the
Internet.
 Several APIs have been designed for
communication. Three among them are
common: socket interface, Transport
Layer
yer Interface (TLI), and STREAM
STREAM.
 Socket interface started in the early
1980s at UC Berkeley as part of a UNIX
environment. The socket interface is a set
of instructions that provide
communication between the application
layer and the operating system, as shown
in Figure.
 The idea of sockets allows us to use the set of all instructions already designed in a programming
language for other sources and sinks. For example, in most computer languages, like C, C++, or
Java, we have several instructions that can
read and write data to other sources and
sinks such as a keyboard (a source), a
monitor (a sink), or a file (source and
sink). We can use the same instructions to
read from or write to sockets.
 We are adding only new sources and
sinks to the programming la language
without changing the way we send data or receive data data. Figure shows the idea and compares the
sockets with other sources and sinks.
Sockets
 Socket
ocket is supposed to behave like a terminal
or a file, it is not a physical entity like them; it
is an abstraction.
raction. It is an object that is
created and used by the application program.
 As far as the application layer is concerned,
communication between a client process and
a server process is communication between
two sockets, created at two ends, as shown in Figure.
 The client thinks that the socket is the entity that receives the request and gives the response; the
server thinks that the socket is the one that has a request and needs the response.
 If we create two sockets, one at each end, and define the sou source
rce and destination addresses
correctly, we can use the available instructions to send and receive data. The rest is the
responsibility of the operating system and the embedded TCP/IP protocol.
Socket Addresses
 The interaction between a client and a server is two-way way communication.
communication In a two-way
communication, we need a pair of addresses
addresses: local (sender) and remote (receiver). The local
address in one direction is the remote address in the other direction and vice versa.
 Since communication in the client
client-server
ver paradigm is between two sockets, we need a pair of
socket addresses for communication: a local socket address and a remote socket address. address We
need to define a socket address in terms of identifiers used in the TCP/IP protocol suite.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -5-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 A socket address should first define the computer on which a client or a server is running. A
computer in the Internet is uniquely defined by its IP address, a 32 32-bit
bit integer in the current
Internet version.
 Several
everal client or server processes may be runni
running at
the same time on a computer, which means that we
need another identifier to define the specific client or
server involved in the communication. An application
program can be defined by a port number, a 16 16-bit integer.. This means that a socket address
should be a combination of an IP address and a port number as shown in Figure.
Figure
 Since a socket defines the end--point
point of the communication, we can say that a socket is identified by
a pair of socket addresses, a local and a remote.
Finding Socket Addresses - Server Site
 How can a client or a server find a pair of socket addresses for communication? The situation is
different for each site.
 The server needs a local (server) and a remote (client) socket address for communication.
 Local Socket Address: The loc
local (server) socket address is provided by the operating system.
system The
operating system knows the IP address of the computer on which the server process is running running.
The port number of a server process, however, needs to be assigned. If the server process is a
standard one defined by the Internet authority, a port number is already assigned to it.
- For example, the assigned port number for a Hypertext Transfer Protocol (HTTP) is the integer 80,
which cannot be used by any other process. If the server process is not standard, the designer of
the server process can choose a port number, in the range defined by the Internet authority, and
assign it to the process. When a server starts running, it knows the local socket address
address.
 Remote Socket Address: The remote socket address for a server is the socket address of the client
that makes the connection.. Since the server can serve many clients, it does not know beforehand
the remote socket address for communication. The server can find this socket address when a
client tries to connect to the server. The client socket address, which is contained in the request
packet sent to the server, becomes the remote socket address that is used for responding to the
client. In other words, although the local socket address fo forr a server is fixed and used during its
lifetime, the remote socket address is changed in each interaction with a different client.
Finding Socket Addresses - Client Site
 The client also needs a local (client) and a remote (server) socket address for comm
communication.
 Local Socket Address: The local (client) socket address is also provided by the operating system.
The operating system knows the IP address of the computer on which the client is running. The
port number, however, is a 1616-bit
bit temporary integer that is assigned to a client process
proc each time
the process needs to start the communication. The port number, however, needs to be assigned
from a set of integers defined by the Internet authority and called the ephemeral (temporary) port
numbers. The operating system, however, needs to guarantee
uarantee that the new port number is not
used by any other running client process
process. The operating system needs to remember the port
number to be able to redirect the response received from the server process to the client process
that sent the request.
 Remote Socket Address: Finding the remote (server) socket address for a client, however, needs
more work. When a client process starts, it should know the socket address of the server it wants
to connect to. We will have two situations in this case.
1. Sometimes,
mes, the user who starts the client process knows both the server port number and IP
address of the computer on which the server is running. This usually occurs in situations when
we have written client and server applications and we want to test them. For example, write
some simple client and server programs and we test them using this approach. In this

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -6-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

situation, the programmer can provide these two pieces of information when he runs the
client program.
2. Although each standard application has a well-known port number, most of the time, we do
not know the IP address. This happens in situations such as when we need to contact a web
page, send an e-mail to a friend, copy a file from a remote site, and so on. In these situations,
the server has a name, an identifier that uniquely defines the server process. Examples of
these identifiers are URLs, such as www.xxx.yyy, or e-mail addresses, such as [email protected].
The client process should now change this identifier (name) to the corresponding server socket
address. The client process normally knows the port number because it should be a well-
known port number, but the IP address can be obtained using another client-server
application called the Domain Name System (DNS).
-----------------------------------------------------------------------------------------------------------------------------
Using Services of the Transport Layer
 A pair of processes provide services to the users of the Internet, human or programs.
 A pair of processes need to use the services provided by the transport layer for communication
because there is no physical communication at the application layer.
 There are three common transport-layer protocols in the TCP/IP suite: UDP, TCP, and SCTP. Most
standard applications have been designed to use the services of one of these protocols.
 When we write a new application, we can decide which protocol we want to use. The choice of the
transport layer protocol seriously affects the capability of the application processes.
UDP Protocol
 UDP provides connectionless, unreliable, datagram service. Connectionless service means that
there is no logical connection between the two ends exchanging messages. Each message is an
independent entity encapsulated in a datagram. UDP does not see any relation (connection)
between consequent datagrams coming from the same source and going to the same destination.
 UDP is not a reliable protocol. Although it may check that the data is not corrupted during the
transmission, it does not ask the sender to resend the corrupted or lost datagram.
 For some applications, UDP has an advantage: it is message-oriented. It gives boundaries to the
messages exchanged. An application program may be designed to use UDP if it is sending small
messages and the simplicity and speed is more important for the application than reliability. For
example, some management and multimedia applications fit in this category.
TCP Protocol
 TCP provides connection-oriented, reliable, byte-stream service. TCP requires that two ends first
create a logical connection between themselves by exchanging some connection-establishment
packets. This phase, which is sometimes called handshaking, establishes some parameters
between the two ends, including the size of the data packets to be exchanged, the size of buffers to
be used for holding the chunks of data until the whole message arrives, and so on.
 After the handshaking process, the two ends can send chunks of data in segments in each direction.
By numbering the bytes exchanged, the continuity of the bytes can be checked.
 For example, if some bytes are lost or corrupted, the receiver can request the resending of those
bytes, which makes TCP a reliable protocol. TCP also can provide flow control and congestion
control.
 One problem with the TCP protocol is that it is not message-oriented; it does not put boundaries
on the messages exchanged. Most of the standard applications that need to send long messages
and require reliability may benefit from the service of the TCP.
SCTP Protocol
 SCTP provides a service which is a combination of the two other protocols. Like TCP, SCTP provides
a connection-oriented, reliable service, but it is not byte-stream oriented.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -7-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 It is a message-oriented
oriented protocol like UDP. In addition, SCTP can provide multi multi-stream service by
providing multiple network-layer layer connections.
 SCTP is normally suitable for any application that needs reliability and at the same time needs to
remain connected, even if a failure occurs in one network network-layer
layer connection.
connection
-----------------------------------------------------------------------------------------------------------------------------
Iterative Communication Using UDP
 Communication between a client program and a server program can occur iteratively or
concurrently. Although several client programs can access the same server program at the same
time, the server program can be designed to respond iiteratively
teratively or concurrently.
 An iterative server can process one client request at a time; it receives a request, processes it, and
sends the response to the requestor before handling another request. When the server is handling
the request from a client, the requests from other clients, and even other requests from the same
client, need to be queued at the server site and wait for the server to be freed.
 The received and queued requests are handled in the firstfirst-in, first-out
out fashion. In this section, we
discuss iterative communication using UDP
UDP.
Sockets Used for UDP
 In UDP communication, the
client and server use only one
socket each. The socket
created at the server site lasts
forever; the socket created at
the client site is closed
(destroyed) when the client
process terminates. Figure
shows the lifetime of the
sockets in the server and client
processes.
 Different clients use different sockets, but the server creates only one socket and changes only
the remote socket address each time a new client make
makes a connection. This is logical,
logical because the
server does know its own socket address, but does not know the socket addresses of the clients
who need its services; it needs to wait for
the client to connect before filling this
part of the socket address.
Flow Diagram
 UDP provides a connectionless service, in
which a client sends a request and the
server sends back a response. Figure
shows a simplified flow diagram for
iterative communication.
 There are multiple clients, but only one
server. Each client is served in each
iteration of the loop in the server. Note
that there is no connection establishment
or connection termination.
 Each client sends a single datagram and
receives a single datagram.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -8-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 In other words, if a client wants to send two datagrams, it is considered as two clients for the
server. The second datagram needs to wait for its turn. The diagram also shows the status of the
socket after each action.
Server Process
 The server makes a passive open open,, in which it becomes ready for the communication, but it waits
until a client process makes the connection
connection. It creates an empty socket.. It then binds the socket to
the server and the well-know know port, in which only part of the socket (the server socket address)
addr is
filled (binding can happen at the time of creation depending on the underlying language).
 The server then issues a receive request command, which blocks until it receives a request from a
client.. The server then fills the rest of the socket (the cclient
lient socket section) from the information
obtained in the request. The request is the process and the response is sent back to the client.
 The server now starts another iteration waiting for another request to arrive (an infinite loop).
Note that in each iteration, the socket becomes only half half-filled
filled again; the client socket address is
erased. It is totally filled only when a request arrives.
Client Process
 The client process makes an active open open.
 Itt starts a connection. It creates an empty socket and then issues the send command, which fully
fills the socket, and sends the request.
 The client then issues a receive command, which is blocked until a response arrives from the
server. The response is then hen handled and the socket is destroyed.
-----------------------------------------------------------------------------------------------------------------------------
Iterative Communication Using TCP
 TCP is a connection-oriented
oriented protocol.
 Before sending or receiving data, a connection needs to be established between the client and the
server.
 After the connection is established, the two parties can send and receive chunks of data as long as
they have data to do so.
 Although iterative communication using TCP is not very common, because it is simpler.
simpler
Sockets Used in TCP
 The TCP server uses two different sockets
sockets, one for connection establishment (listen socket) and
the other for data transfer (socket
socket).. The reason for having two types of sockets is to separate the
connection phase from the
data exchange phase.
 A server uses a listen socket
to listen for a new client
trying to establish
connection.
 After the connection is
established, the server
createss a socket to exchange
data with the client and
finally to terminate the
connection. The client uses
only one socket for both
connection establishment and data exchange (see Figure).

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -9-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

Flow Diagram
 Figure shows a simplified flow diagram
for iterative communication using TCP.
There are multiple clients, but only
one server.
 Each client is served in each iteration
of the loop. The flow diagram is
almost similar to the one for UDP, but
there are differences ences that we explain
for each site.
Server Process
 In Figure, the TCP server process, like
the UDP server process, creates a
socket and binds it, but these two
commands create the listen socket to
be used only for the connection
establishment phase.
 The server process then calls the listen
procedure, to allow the operating
system to start accepting the clients,
completing the connection phase, and
putting them in the waiting list to be
served.
 The server process now starts a loop and serves the clien clientsts one by one. In each iteration, the server
process issues the accept procedure that removes one client from the waiting list of the connected
clients for serving.
 If the list is empty, the accept procedure blocks until there is a client to be served. Wh When the accept
procedure returns, it creates a new socket for data transfer. The server process now uses the client
socket address obtained during the connection establishment to fill the remote socket address field
in the newly created socket. At this time the client and server can exchange data.
Client Process
 The client flow diagram is almost similar to the UDP version except that the client data data-transfer box
needs to be defined for each specific case.
-----------------------------------------------------------------------------------------------------------------------------
Concurrent Communication
 A concurrent server can process several client requests at the same time. This can be done using
the available
lable provisions in the underlying programming language.
 In C, a server can create several child processes, in which a child can handle a client. In Java,
threading allows several clients to be handled by each thread.
-----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -10-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

Chapter 26:: Standard Client-Server Protocols [P-854]


854]
World Wide Web and HTTP, FTP, Electronic Mail, Domain Name System (DNS), TELNET,
Secure Shell (SSH)
-------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
----------------------------------------------
World Wide Web and HTTP
World Wide Web
 The Web today is a repository of information in which the documents
documents, called web pages, are
distributed all over the world and related documents are linked together.
 The popularity and growth of the Web can be related to two terms in the above statement:
distributed and linked.
 Distribution allows the growth of the Web
Web.. Each web server in the world can add a new web page
to the repository and announce it to all Internet users without overloading a few servers.
 Linking allows one web page to refer to another web page stored in another server somewhere
else in the world. The linking of web pages was achieved using a concept called hypertext, which
was introduced many years before the advent of the Internet.
 The idea was to use a machine that automatically retrieved another document stored in the system
when a link to it appeared
ppeared in the document. The Web implemented this idea electronically to allow
the linked document to be retrieved when the link was clicked by the user. Today, the term
hypertext,, coined to mean linked text documents, has been changed to hypermedia,
hypermedia to show that
a web page can be a text document, an image, an audio file, or a video file.
Architecture
 The WWW today is a distributed client
client-server
server service, in which a client using a browser can access a
service using a server. However, the service provided iiss distributed over many locations called sites.
Each site holds one or more web pages. Each web page, however, can contain some links to other
web pages in the same or other sites.
 A web page can be simple or composite. A simple web page has no links to o other web pages; a
composite web page has one or more links to other web pages. Each web page is a file with a name
and address.
Web Client (Browser)
 A variety of vendors offer commercial browsers that interpret and display a web page, and all of
them use nearly
early the same architecture. Each browser usually consists of three parts:
parts a controller,
client protocols, and interpreters
interpreters. (see Figure).

 The controller receives input from the keyboard or the mouse and uses the client programs to
access the document. After the document has been accessed, the controller uses one of the
interpreters to display the document on the screen.
 The client protocol can be one of the protocols such as HTTP or FTP.. The interpreter can be HTML,
Java, or JavaScript, depending on the type of document. Some commercial browsers include
Internet Explorer, Netscape Navigator, and Firefox
Firefox.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -11-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

Web Server
 The web page is stored at the server. Each time a request arrives, the corresponding document is
sent to the client.
 To improve efficiency, servers normally store requested files in a cache in memory; memory is
faster to access than a disk. A server can also become more efficient through multithreading or
multiprocessing. In this case, a server can answer more than one request at a time. Some popular
web servers include Apache and Microsoft Internet Information Server (IIS).
Uniform Resource Locator (URL)
 A web page, as a file, needs to have a unique identifier to distinguish it from other web pages.
 To define a web page, we need three identifiers: host, port, and path. However, before defining
the web page, we need to tell the browser what client-server application we want to use, which is
called the protocol. This means we need four identifiers to define the web page.
o The first is the type of vehicle to be used to fetch the web page;
o the last three make up the combination that defines the destination object (web page).
 Protocol: The first identifier is the abbreviation for the client-server program that we need in order
to access the web page. Although most of the time the protocol is HTTP (HyperText Transfer
Protocol), FTP (File Transfer Protocol).
 Host: The host identifier can be the IP address of the server or the unique name given to the server.
IP addresses can be defined in dotted decimal notation (such as 64.23.56.17); the name is normally
the domain name that uniquely defines the host, such as thagadoor.in.
 Port: The port, a 16-bit integer, is normally predefined for the client-server application. For
example, if the HTTP protocol is used for accessing the web page, the well-known port number is
80. However, if a different port is used, the number can be explicitly given.
 Path: The path identifies the location and the name of the file in the underlying operating system.
The format of this identifier normally depends on the operating system. In UNIX, a path is a set of
directory names followed by the file name, all separated by a slash. For example, /vtu/bcs502/ is a
path that uniquely defines a file named bcs502, stored in the directory last, which itself is part of
the directory next, which itself is under the directory top.
 To combine these four pieces together, the uniform resource locator (URL) has been designed; it
uses three different separators between the four pieces as shown below:
protocol://host/path Used most of the time
protocol://host:port/path Used when port number is needed
Web Documents
 The documents in the WWW can be grouped into 3 broad categories: static, dynamic, and active.
Static Documents
 Static documents are fixed-content documents that are created and stored in a server. The client
can get a copy of the document only. When a client accesses the document, a copy of the
document is sent. The user can then use a browser to see the document. Static documents are
prepared using one of several languages:
o HyperText Markup Language (HTML)
o Extensible Markup Language (XML)
o Extensible Style Language (XSL)
o Extensible Hypertext Markup Language (XHTML).
Dynamic Documents
 A dynamic document is created by a web server whenever a browser requests the document.
When a request arrives, the web server runs an application program or a script that creates the
dynamic document.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -12-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

 The server returns the result of the program or script as a response to the browser that requested
the document. Because a fresh document is created for each request, the contents of a dynamic
document may vary from one request to another.
 A very simple example of a dynamic document is the retrieval of the time and date from a server.
Time and date are kinds of information that are dynamic in that they change from moment to
moment. The client can ask the server to run a program such as the date program in UNIX and send
the result of the program to the client.
 Although the Common Gateway Interface (CGI) was used to retrieve a dynamic document in the
past, today’s options include one of the scripting languages such as Java Server Pages (JSP), which
uses the Java language for scripting, or Active Server Pages (ASP), a Microsoft product that uses
Visual Basic language for scripting, or ColdFusion, which embeds queries in a Structured Query
Language (SQL) database in the HTML document.
Active Documents
 For many applications, we need a program or a script to be run at the client site. These are called
active documents. For example, suppose we want to run a program that creates animated graphics
on the screen or a program that interacts with the user.
 The program definitely needs to be run at the client site where the animation or interaction takes
place. When a browser requests an active document, the server sends a copy of the document or a
script. The document is then run at the client (browser) site. One way to create an active
document is to use Java applets, a program written in Java on the server. It is compiled and ready
to be run. The document is in bytecode (binary) format. Another way is to use JavaScripts but
download and run the script at the client site.
-----------------------------------------------------------------------------------------------------------------------------------------------------
HyperText Transfer Protocol (HTTP)
 The HyperText 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 is a connection-oriented and reliable protocol. This means that, before any
transaction between the client and the server can 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.
Non-persistent vs Persistent Connections
 The hypertext concept embedded in web page documents may require several requests and responses. If
the web pages, objects to be retrieved, are located on different servers, we do not have any other choice
than to create a new TCP connection for retrieving each object.
 If some of the objects are located on the same server, we have two choices:
o to retrieve each object using a new TCP connection (non-persistent connection)or
o to make a TCP connection and retrieve them all (persistent connection).
 HTTP, prior to version 1.1, specified non-persistent connections, while persistent connections are the default
in version 1.1, but it can be changed by the user.
Non-persistent Connections
 In a non-persistent connection, one TCP connection is made for each request/response. The following lists
the steps in this strategy:
1. The client opens a TCP connection and sends a request.
2. The server sends the response and closes the connection.
3. The client reads the data until it encounters an end-of-file marker; it then closes the connection.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -13-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 In this strategy, if a file contains links to N different pictures in different files (all located on the
same server), the connection must be opened and closed N + 1 times. The non-persistent
non strategy
imposes high overhead on the server because the server needs N + 1 different buffers each time a
connection is opened.

 The client needs to access a file that contains one link to an image. The text file and image are
located on the same server. Here we need two connections. For each connection, TCP requires at
least three handshake messages to establish the connection, but the request can be sent with the
third one. After the connection is established, the object can be transferred. After receiving an
object, another three handshake messages are needed to te terminate
rminate the connection.
connection
Persistent Connections
 HTTP version 1.1 specifies a persistent
connection by default. In a persistent
connection, the server leaves the
connection open for more requests after
sending a response.
 The server can close the connectio
connection at the
request of a client or if a time
time-out has
been reached. The sender usually sends
the length of the data with each response.
 There
here are some occasions when the
sender does not know the length of the
data. This is the case when a document is
created dynamically or actively. In these
cases, the server informs the client that
the length is not known and closes the connection after sending the data so the client knows that
the end of the data has been reached.
 Time and resources are saved using persiste
persistent connections.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -14-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 Only one set of buffers and variables needs to be set for the connection at each site. The round trip
time for connection establishment and connection termination is saved.
Message Formats
 The HTTP protocol defines the format of the request and response messages, as shown in Figure. Fig
We have put the two formats next to each other for comparison. Each message is made of four
sections. The first section in the request message is called the request line; the first section in the
response message is called the status line. The other three sections have the same names in the
request and response messages.

Request Message
 The first line in a request message is called a request line.. There are three fields in this line
separated by one space and terminated by two characters (carriage return and line feed) as shown
in Figure. The fields
are called method,
URL, and version.
 The method field
defines the request
types. In version 1.1
of HTTP, several
methods are
defined, as shown
in Table.
 Most of the time,
the client uses the GET method to send a request. The PUT method is the inverse of the GET
method; it allows the client to post a new web page on the server (if permitted). The POST method
is similar to the PUT method, but it is used to send some information to the server to be added to
the web page or to modify the web page.
 The TRACE method is used for debugging; the client asks the server to echo back the request to
check whether the server is getting th
the requests. The DELETE method allows the client to delete a
web page on the server if the client has permission to do so. The CONNECT method was originally
made as a reserve method; it may be used by proxy servers, as discussed later. Finally, the
OPTIONS method allows the client to ask about the properties of a web page.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -15-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 The second field, URL.. It


defines the address and name
of the corresponding web
page. The third field, version
version,
gives the version of the
protocol; the most current
version of HTTP is 1.1.
 After the request line, we can
have zero or more request
header lines. Each header line
sends additional information
from the client to the server.
 For example, the client can
request that the document be
sent in a special format. Each header line has a header name, a colon, a space,
space and a header value.
The following Table shows some header names commonly used in a request request. The value field
defines the values associated with each header name. The list of values can be found in the
corresponding RFCs. The body ody can be present in a request message. Usually, it contains the
comment to be sent or the file to be published on the website when the method is PUT or POST.
Response Message
 A response message consists of a status line, header lines, a blank line, and sometimes a body.
The first line in a response message is called the status line.
 There are three fields in this line separated by spaces and terminated by a carriage return and line
feed. The first field defines the version of HTTP protocol, currently 1.1. .1. The status code field
defines the status of the request. It consists of three digits.. Whereas the codes in the 100 range are
only informational, the
codes in the 200 range
indicate a successful
request. The codes in the
300 range redirect the
client to another URL, and
the codes in the 400 range
indicate an error at the
client site. Finally, the
codes in the 500 range
indicate an error at the
server site. The status
phrase explains the status
code in text form.
 After the status line, we
can have zero or more response header lines. Each header line sends additional information from
the server to the client. For example, the sender can send extra information about the document.
Each header line has a header name, a colon, a space, and a header value. We wi will show some
header lines in the examples at the end of this section. Table shows some header names
commonly used in a response message.
 The body contains the document to be sent from the server to the client client. The body is present
unless the response is an error message.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -16-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

Conditional Request
 A client can add a condition in its request. In this case, the server will send the requested web
page if the condition is met or inform the client otherwise. One of the most common conditions
imposed by the client is the time and date the web page is modified. The client can send the
header line If-Modified-Since with the request to tell the server that it needs the page only if it is
modified after a certain point in time.
Cookies
 The World Wide Web was originally designed as a stateless entity. A client sends a request; a server
responds. Their relationship is over. The original purpose of the Web, retrieving publicly available
documents, exactly fits this design. Today the Web has other functions that need to remember
some information about the clients; some are listed below:
1. Websites are being used as electronic stores that allow users to browse through the store,
select wanted items, put them in an electronic cart, and pay at the end with a credit card.
2. Some websites need to allow access to registered clients only.
3. Some websites are used as portals: the user selects the web pages he wants to see.
4. Some websites are just advertising agencies. For these purposes, the cookie mechanism was
devised.
Creating and Storing Cookies
 The creation and storing of cookies depend on the implementation.
1. When a server receives a request from a client, it stores information about the client in a file
or a string. The information may include the domain name of the client, the contents of the
cookie (information the server has gathered about the client such as name, registration
number, and so on), a timestamp, and other information depending on the implementation.
2. The server includes the cookie in the response that it sends to the client.
3. When the client receives the response, the browser stores the cookie in the cookie directory,
which is sorted by the server domain name.
Using Cookies
 When a client sends a request to a server, the browser looks in the cookie directory to see if it can
find a cookie sent by that server. If found, the cookie is included in the request. When the server
receives the request, it knows that this is an old client, not a new one.
 The contents of the cookie are never read by the browser or disclosed to the user. It is a cookie
made by the server and eaten by the server. Now let us see how a cookie is used for the four
previously mentioned purposes:
o An electronic store (e-commerce) can use a cookie for its client shoppers. When a client selects
an item and inserts it in a cart, a cookie that contains information about the item, such as its
number and unit price, is sent to the browser. If the client selects a second item, the cookie is
updated with the new selection information, and so on. When the client finishes shopping and
wants to check out, the last cookie is retrieved and the total charge is calculated.
o The site that restricts access to registered clients only sends a cookie to the client when the
client registers for the first time. For any repeated access, only those clients that send the
appropriate cookie are allowed.
o A web portal uses the cookie in a similar way. When a user selects her favorite pages, a cookie
is made and sent. If the site is accessed again, the cookie is sent to the server to show what the
client is looking for.
o A cookie is also used by advertising agencies. An advertising agency can place banner ads on
some main website that is often visited by users. The advertising agency supplies only a URL
that gives the advertising agency’s address instead of the banner itself. When a user visits the
main website and clicks the icon of a corporation, a request is sent to the advertising agency.
o The advertising agency sends the requested banner, also includes a cookie with the ID of the user.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -17-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

Web Caching
 Proxy Servers HTTP supports proxy servers
servers. A proxy server is a computer that keeps copies of
responses to recent requests. The HTTP client sends a request to the proxy server. The proxy server
checks its cache. If the response is not stored in the cache, the proxy server sends the request to
the corresponding server. Incoming responses are sent to the proxy server and stored for future
requests from other clients.
Proxy Server Location
 The proxy servers are normally located at the client site. This means that we can have a hierarchy
of proxy servers, as shown below:
1. A client computer can also be used as a proxy server, in a small capacity, that stores responses
to requests often invoked by the client.
2. In a company, a proxy server may be installed on the computer LAN to reduce the load going
out of and coming into the LAN.
3. An ISP with many customers can install a proxy server to reduce the load going out of and
coming into the ISP network.
Cache Update
How
ow long a response should remain in the proxy server be before
fore being deleted and replaced?
 One solution is to store the
he list of sites whose information remains the same for a while.
 For example, a news agency may change its news page every morning. This means that a proxy
server can get the news early in the morning and keep it until the next day.
 Another recommendation is to add some headers to show the last modification time of the
information. The proxy server can then use the information in this header to guess how long the
information would be valid.
HTTP Security
 HTTP per se does not provide security. HTTP can be run over the Secure Socket Layer (SSL). In this
case, HTTP is referred to as HTTPS. HTTPS provides confidentiality, client and server authentication,
and data integrity.
-------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------
FTP (File Transfer Protocol)
Topics covered: Two Connections - Control Connection - Data Connection - Security for FTP
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
 File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP for copying a file from one
host to another. Although transferring files from one system to another seems simple and
straightforward, some problems must be dealt with first.
 For example, two systems may use different file name conventions. Two systems may have
different ways to represent data. Two systems may have different directory structures. All of these
problems have been solved by FTP in a very simple and elegant approach.
 Although we can transfer files using HTTP, FTP is a better choice to transfer large files or to transfer
files using different formats. Figure shows the basic model of FTP.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -18-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 The client has three components


1. The user interface
2. The client control process
3. The
he client data transfer process
process.
 The server has two components
1. The server control process
2. The
he server data transfer process.
 The control connection is made between the control processes. The data connection is made
between the data transfer processes.
 Separation of commands and data transfer makes FTP more efficient
efficient.. The control connection uses
very simple rules of communication. We need to transfer only a line of command or a line of
response at a time. The data connection, on the other hand, needs more complex rules due to the
variety of data types transferred.
Two Connection
 The two connections in FTP have different lifetimes. The control connection remains connected
during the entire interactive FTP session. The data connection is opened and then closed for each
file transfer activity. It opens each time commands that involve transferring files are used, and it
closes when the file is transferred.
 When
hen a user starts an FTP session, the control connection opens. While the control connection is
open, the data connection can be opened and closed multiple times if several files aare transferred.
FTP uses two well-known
known TCP ports: port 21 is used for the control connection, and port 20 is used
for the data connection.
Control Connection
 For control communication, FTP uses the NVT ASCII character set as used by TELNET.
Communication is achieved through commands and responses.
 Each line is
terminated with a
two-character
(carriage return
and line feed) end-
of-line token.
During this control
connection,
commands are
sent from the
client to the server
and responses are
sent from the
server to the client.
 Commands, which
are sent from the
FTP client control
process, are in the
form of ASCII
uppercase, which
may or may not be
followed by an
argument. Some of
the most common commands are shown in Table.

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -19-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 Every FTP command generates at least one response. A response has two parts: a three-digit
number followed by text.
 The numeric part defines
the code; the text part
defines needed
parameters or further
explanations. The first digit
defines the status of the
command. The second digit
defines the area in which
the status applies. The
third
hird digit provides additional information. Table shows some common responses.
Data Connection
 The data connection uses the well well-known port 20 at the server site.. However, the creation of a
data connection is different from the control connection. The following shows the steps:
1. The client, not the server, issues a passive open using an ephemeral port. This must be done by
the client because it is the client that issues the commands for transferring files.
2. Using the PORT command the client sends this port number to the serverserver.
3. The server receives the port number and issues an active open using the wellknown port 20
and the received ephemeral port number
number.
Communication
ation over Data Connection
 The purpose and implementation of the data connection are different from those of the control
connection.
 We want to transfer files through the data connection. The client must define the type of file to be
transferred, the structure
ucture of the data, and the transmission mode. Before sending the file through
the data connection, we prepare for transmission through the control connection.
 The heterogeneity problem is resolved by defining three attributes of communication
communication: file type,
data structure, and transmission mode
mode.
File Type
 FTP can transfer one of the following file types across the data connection: ASCII file, EBCDIC file,
or image file.
Data Structure
 FTP can transfer a file across the data connection using one of the following
lowing interpretations of the
structure of the data:
o File structure format (used by default) has no structure. It is a continuous stream of bytes
bytes.
o Record structure - the file is divided into records. This can be used only with text files
files.
o Page structure. the file is divided into pages
pages,, with each page having a page number and a page
header. The pages can be stored and accessed randomly or sequentially.
Transmission Mode
 FTP can transfer a file across the data connection using one of the following three transmission
modes: stream mode, block mode, or compressed mode mode.. The stream mode is the default mode;
data are delivered from FTP to TCP as a continuous stream of bytes. In the block mode, data can be
delivered from FTP to TCP in blocks.
 In this case, each h block is preceded by a 33-byte header.. The first byte is called the block descriptor;
the next two bytes define the size of the block in bytes
bytes.
File Transfer: File transfer occurs over the data connection under the control of the commands sent
over the control
ontrol connection. File transfer in FTP one of three things: retrieving a file (server to client),
storing a file (client to server), and directory listing (server to client).

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -20-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25 ODD)

Security for FTP


 The FTP protocol was designed when security was not a big issue.
 Although FTP requires a password, the password is sent in plaintext (unencrypted), which means it
can be intercepted and used by an attacker.
 The data transfer connection also transfers data in plaintext, which is insecure.
 To be secure, one can add a Secure Socket Layer between the FTP application layer and the TCP
layer. In this case FTP is called SSL-FTP.
---------------------------------------------------------------------------------------------------------------------------------------------------
Electronic Mail
 Electronic mail (or e-mail) allows users to exchange messages.
 The nature of this application, however, is different from other applications discussed so far. In an
application such as HTTP or FTP, the server program is running all the time, waiting for a request
from a client. When the request arrives, the server provides the service.
 There is a request and there is a response. In the case of electronic mail, the situation is different.
 First, e-mail is considered a one-way transaction.
 Second, it is neither feasible nor logical for a person1 to run a server program and wait until
someone sends an e-mail to him. Person2 may turn off his computer when he is not using it.
 This means that the idea of client/server programming should be implemented in another way:
using some intermediate computers (servers). The users run only client programs when they want
and the intermediate servers apply the client/server paradigm.
Architecture
 To explain the architecture of e-mail, we give a common scenario, as shown in Figure. Another
possibility is the case in which RAM or SITA is directly connected to the corresponding mail server,
in which LAN or WAN connection is not required.

 In the common scenario, the sender and the receiver of the e-mail, RAM and SITA respectively, are
connected via a LAN or a WAN to two mail servers. The administrator has created one mailbox for
each user where the received messages are stored.
 A mailbox is part of a server hard drive, a special file with permission restrictions. Only the owner of
the mailbox has access to it. The administrator has also created a queue (spool) to store messages
waiting to be sent.
 A simple e-mail from RAM to SITA takes nine different steps, as shown in the figure. RAM and SITA
use three different agents: a user agent (UA), a message transfer agent (MTA), and a message
access agent (MAA).

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -21-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 When RAM needs to send a message to SITA , she runs a UA program to prepare the message and
send it to her mail server. The mail server at her site uses a queue (spoo (spool) to store messages
waiting to be sent. The message, however, needs to be sent through the Internet from RAM’s site
to SITA ’s site using an MTA. Here two message transfer agents are needed: one client and one
server. Like most client-server
server programs on the Internet, the server needs to run all the time
because it does not know when a client will ask for a connection. The clien
client, on the other hand, can
be triggered by the system when there is a message in the queue to be sent. The user agent at the
SITA site allows SITA to read the received message. SITA later uses an MAA client to retrieve the
message from an MAA server runnrunning on the second server.
 There are two important points we need to emphasize here.
1. First, SITA cannot bypass the mail server and use the MTA server directly. To use the MTA
server directly, SITA would need to run the MTA server all the time because he do does not know
when a message will arrive. This implies that SITA must keep his computer on all the time if he
is connected to his system through a LAN. If he is connected through a WAN, he must keep the
connection up all the time. Neither of these situations is feasible today.
2. Second, SITA needs another pair of client
client-server
server programs: message access programs. This is
because an MTA client-server
server program is a push program: the client pushes the message to
the server. SITA needs a pull program. The client needs to pull the message from the server.
We discuss more about MAAs shortly.
User Agent
 The first component of an electronic mail system is the user agent (UA). It provides service to the
user to make the process of sending and receiving a message easier. A user agent is a software
package (program) that composes, reads, replies to, and forwards messages
messages. It also handles local
mailboxes on the user computers
computers.
 There are two types of user agents
agents: command-driven and GUI-basedbased. Command-driven user
agents belong to the early days of electronic mail. They are still present as the underlying user
agents. A command-driven
driven user agent normally accepts a onecharacter command from the
keyboard to perform its task. For example, a user can type the character r, at the command
prompt, to reply to the sender of the message, or type the character R to reply to the sender and
all recipients. Some examples of commanddriven user agent
agentss are mail, pine, and elm.
 Modern user agents are GUI--based.. They contain graphical user interface (GUI) components that
allow the user to interact with the software by using both the keyboard and the mouse. They have
graphical components such as icons, m menu
enu bars, and windows that make the services easy to
access. Some examples of GUI--based user agents are Eudora and Outlook.
 To send mail, the user, through the UA, creates mail that looks very similar to postal mail. It has an
envelope and a message.. The envelope usually contains the sender address, the receiver address,
and other information. The
message contains the header
and the body. The header of the
message defines the sender, the
receiver,, the subject of the
message, and some other
information. The body of the
message contains the actual
information to be read by the
recipient.
Receiving Mail
 The user agent is triggered by
the user (or a timer). If a user has

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -22-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

mail, the UA informs the user with a notice. If the user is ready to read the mail, a list is displayed in
which each line contains a summary of the information about a particular message in the mailbox.
The summary usually includes the sender mail address, the subject, and th the time the mail was sent
or received. The user can select any of the messages and display its contents on the screen.
Addresses
 To deliver mail, a mail handling
system must use an addressing
system with unique addresses. In
the Internet, the address consis
consists
ts of two parts: a local part and a domain name, separated
separ by an @
sign (see Figure).
Mailing List or Group List
 Electronic mail allows one name, an alias, to repres
represent
ent several different e-mail
e addresses; this is
called a mailing list. Every time a message is to be sent, the system checks the recipient’s name
against the alias database; if there is a mailing list for the defined alias, separate messages, one for
each entry in the list, must be prepared and handed to the MTA.
Message Transfer Agent: SMTP
 The e-mail is one of those applications that needs three uses of client-server
client paradigms to
accomplish its task. It is important that we distinguish these three when we are dealing with e-mail.
e
Figure shows these three client
client-server applications.. We refer to the first and the second as
Message Transfer Agents (MTAs), the third as Message Access Agent (MAA).

 The formal protocol that defines the MTA client and ser
server
ver in the Internet is called Simple Mail
Transfer Protocol (SMTP). SMTP is used two times, between the sender and the sender’s mail
server and between the two mail servers. As we will see shortly, another protocol is needed
between the mail server and the
receiver. SMTP simply defines
how commands and responses
must be sent back and forth.
 Commands and Responses
Responses:
SMTP uses commands and
responses to transfer messages
between an MTA client and an
MTA server. The command is from
an MTA client to an MTA serverserver;
the response is from an MTA
server to the MTA client. Each
command or reply is terminated by
a two character (carriage return
and line feed) end-of-line token.
 Commands are sent from the
client to the server. The format
of a command is shown here- 

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -23-


BCS502 COMPUTER NETWORKS III Year – V Sem (2024-25
(2024 ODD)

 Responses: Responses are sent from the server to the client. A response is a three digit code that
may be followed by additional textual information. Table shows the most common response types.

Mail Transfer Phases


 The process of transferring a mail messag
message occurs in three phases: connection establishment, mail
transfer, and connection termination
termination.
 Connection Establishment: After a client has made a TCP connection to the wellknown port 25, the
SMTP server starts the connection phase. This phase involves the following three steps:
1. The server sends code 220 (service ready) to tell the client that it is ready to receive mail. If the
server is not ready, it sends code 421 (service not available).
2. The client sends the HELO message to identify itself, using its domain name address. This step
is necessary to inform the server of the domain name of the client.
3. 3. The server responds with code 250 (request command completed) or some other code
depending on the situation.
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
Domain Name System (DNS)

-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
TELNET

-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
Secure Shell (SSH)

--------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------

Prof. Parthasarathy P V (M) 8951523822 URL: www.thagadoor.in/vtu/BCS502/ Page -24-

You might also like