0% found this document useful (0 votes)
14 views37 pages

Unit 2 - Part Ii

The document covers key concepts in the Application Layer of Computer Networks, including user-server interactions through cookies, web caches, FTP, email protocols (SMTP, POP3, IMAP), and the Domain Name System (DNS). It explains how cookies are used for user session management, the role of web caches in reducing response times, and the functioning of FTP for file transfers. Additionally, it details the processes involved in sending and receiving emails and the hierarchical structure of DNS for translating domain names into IP addresses.
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)
14 views37 pages

Unit 2 - Part Ii

The document covers key concepts in the Application Layer of Computer Networks, including user-server interactions through cookies, web caches, FTP, email protocols (SMTP, POP3, IMAP), and the Domain Name System (DNS). It explains how cookies are used for user session management, the role of web caches in reducing response times, and the functioning of FTP for file transfers. Additionally, it details the processes involved in sending and receiving emails and the hierarchical structure of DNS for translating domain names into IP addresses.
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/ 37

Computer Networks (CN)

GTU #3150710

Unit-2:
Application Layer
Part-2

Prof. Maulik D Trivedi


Computer Engineering Department
Darshan Institute of Engineering & Technology, Rajkot
[email protected]
+91-9998265805
 Outline
Looping
• Principles of Computer Applications
• Web
• HTTP
• E-mail
• DNS
• Socket programming with TCP and UDP
User-Server interactions: Cookie
User-Server interactions: Cookie
 A small text file that is stored in the user's computer either temporarily for that session only or
permanently on the hard disk.
 Cookies provide a way for the Web site to recognize you and keep track of your preferences.
 The cookie technology has four components:
1. A cookie header line in the HTTP response message
2. A cookie header line in the HTTP request message
3. A cookie file kept on the user’s end system and managed by the user’s browser
4. A back-end database at the Web site

Authorization Recommendations

Use of Cookies

User session state


Shopping carts
(Web, Email)

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 4


Cookies - Example

client server

ebay 8734 usual http request msg server


cookie file creates ID
usual http response 1678 for user backend
set-cookie: 1678 create
ebay 8734 entry database
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action
one week later:
access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
specific
usual http response msg action

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 5


Web Caches (Proxy Server)
Web Caches (Proxy Server)
 It satisfies HTTP requests on the behalf of an origin Web server.
 The Web cache has its own disk storage and keeps copies of recently requested objects in this
storage.

proxy
server
client
origin
server

client origin
server

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 7


Web Caches (Proxy Server) – Cont...
 A user’s browser can be configured so, user’s HTTP requests are first directed to the Web
Cache.
 A browser sends all HTTP requests to cache.
 As an example, suppose a browser is requesting the object
http://www.someschool.edu/campus.gif
 Object in cache returns to client browser.
 Otherwise cache requests object from origin server, then returns object to client browser.
 Reduce response time for client request.
 Reduce traffic on an institution’s access link.
 Internet dense with caches: Insufficiency for content providers to effectively deliver content.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 8


Web Caches (Proxy Server) – Example
 Example: Institutional Network and Internet
 Reduce response time for client request.
 Reduce traffic on an institution’s access link.
 Internet dense with caches: Insufficiency for
content providers to effectively deliver content.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 9


FTP (File Transfer Protocol)
FTP (File Transfer Protocol)
 File Transfer Protocol (FTP) is the commonly used protocol for exchanging files over the
Network or Internet.
 Example: Filezilla
 FTP uses the Internet's TCP/IP protocols to enable data transfer.
 FTP uses client-server architecture.
 FTP promotes sharing of files via remote computers with reliable and efficient data transfer.

FTP user FTP File transfer FTP


interface client server
User or
Host

Local file system Remote file system


Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 11
FTP (File Transfer Protocol) – Cont…
 FTP client connect FTP server at port 21 using TCP.
 FTP uses two parallel TCP connections to transfer a file,
 Control Connection: Used for sending control information between two hosts.
 Data Connection: To send a file.
 Control Information like user identification, password, commands to change remote
directory, commands to “put” and “get” files
 Client will browse remote file directory, sends commands over control
connection.
 FTP server maintains “ state ” about user like current directory, earlier
authentication.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 12


FTP (File Transfer Protocol) – Example

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 13


Electronic Mail (Email)
Electronic Mail (Email)
 Email is an asynchronous communication medium in
which people send and read messages as convenient for
them.
 Modern Email has many powerful features like:
 A messages with attachments
 Hyperlinks
 HTML-formatted text
 Embedded photos
 Email is fast, easy to distribute, and inexpensive.
 High level view of Internet mail system and its key
components.
 User agents
 Mail servers
 Simple Mail Transfer Protocol (SMTP)

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 15


Email - Cont…
 User Agent user
agent
 User agents allow users to read, reply to, forward, save,
and compose messages. mail user
 E.g. Microsoft Outlook and Apple Mail. server agent

 Mail servers: SMTP mail user


 A mailbox contains incoming messages for user. server agent
 A message queue of outgoing (to be sent) mail messages. SMTP
 SMTP SMTP user
 It is a principal application layer protocol between mail mail
agent
servers to send email messages. server
▪ client: sending mail to server user
agent
▪ server: receiving mail from other different mail server
user
agent
Outgoing
message queue
user mailbox

Prof. Maulik Trivedi #3150710(CN)  Unit 2 – Application Layer 16


SMTP
 Simple Mail Transfer Protocol used in sending and receiving e-mail.
 It use TCP to reliably transfer email message from client to server using port 25.
 It restricts the body (not just the headers) of all mail messages to simple 7-bit ASCII.
 SMTP does not use intermediate mail servers for sending mail.
 If receiving end mail server is down, the message remains in sending end mail server and waits
for a new attempt.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 17


SMTP - Example

1. Alice uses user agent to compose 4. SMTP client sends Alice’s


message to message over the TCP connection.
[email protected]
1)2)
Alice
4)
3) Alice’s
uses
Client
5)
SMTP
Bob’suser
user
side ofagent
client
mail agent
sends
SMTPsends
serverto compose
message
Alice’s
opens
places TCP
messageto5.over
herBob’s
message
the connection
message mail
in
the mail server places the
towith
Bob’s
TCP
2. Alice’s user agent sends 6) Bob invokes his user agent to readmessage
message message in Bob’s mailbox.
server; message placed
Bob’s inserver
message queue.
connection
mail
mailbox
[email protected]
to her mail server; message placed 6. Bob invokes his user agent to read
in message queue. message.
3. Client side of SMTP opens TCP
connection with Bob’s mail server.
Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 18
Mail Access Protocols (POP3 and IMAP)

user
mail access user
SMTP SMTP protocol agent
agent
(e.g., POP,
IMAP)

sender’s mail receiver’s mail


server server
 POP3
 Post Office Protocol – Version 3
 IMAP
 Internet Mail Access Protocol
 A mail access protocol, such as POP3, is used to transfer mail from the recipient’s mail server
to the recipient’s user agent.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 19


POP3 – Post Office Version 3
 POP3 is an extremely simple mail access protocol.
 With the TCP connection established, POP3 progresses through three phases: authorization,
transaction and update.
 In authorization, the user agent sends a username and a password to authenticate the user.
 In transaction, the user agent retrieves messages, mark messages for deletion, remove deletion
marks and obtain mail statistics.
 In update, after the quit command by client, ending the POP3 session; the mail server deletes
marked messages.
 POP3 is designed to delete mail on the server as soon as the user has downloaded it.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 20


IMAP - Internet Mail Access Protocol
 To keeps all messages in one place: at server
 The recipient can then move and organize the message into a new, user-created folder, read the
message, delete the message, move messages from one folder to another and so on.
 To allow users to search remote folders for messages matching specific criteria.
 Also permit a user agent to obtain components of messages, When low-bandwidth connection
between the user agent and its mail server.
 In this case, user not to download all the messages in its mailbox, particularly avoiding long
messages like an audio or video clip.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 21


DNS - Domain Name System
DNS - Domain Name System

Alphabetic name remember IP Address


by human
 It is an internet service that translates domain names into IP addresses.
 It is application-layer protocol. DNS service must translate the domain name into the
corresponding IP address.
 In DNS system, If one DNS server doesn't know how to translate a particular domain name, it
asks another one, and so on, until the correct IP address is returned.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 23


DNS - Example

 DNS client wants to determine the IP address for the hostname www.amazon.com
 The client first contacts one of the root servers, which returns IP addresses for TLD servers -
top-level domain .com.
 Then contacts TLD servers, which returns the IP address of an authoritative server for
www.amazon.com
 Finally, contacts one of the authoritative servers for www.amazon.com, which returns the IP
address for the hostname www.amazon.com.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 24


DNS: A distributed - hierarchical database
 Root DNS Servers – Total 13

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 25


DNS – Cont…
 Top-level domain (TLD) servers:
 It is responsible for com, org, net, edu, aero, jobs, museums, and all top-level country domains, e.g.: uk, fr, ca,
jp
 Network Solutions maintains servers for .com TLD
 Education for .edu TLD
 Authoritative DNS servers:
 To organization’s own DNS servers, providing authoritative hostname to IP mappings for organization’s
named hosts.
 It can be maintained by organization or service provider.
 Local DNS name servers:
 It does not strictly belong to hierarchy
 when host makes DNS query, query is sent to its local DNS server.
▪ It acts as proxy, forwards query into hierarchy.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 26


DNS - Example

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 27


DNS Name Resolution Example
 Iterated Query: root DNS server
 A host at cis.poly.edu wants IP address for
gaia.cs.umass.edu
2
3
TLD DNS server
4

local DNS server


dns.poly.edu
7 6
1 8

authoritative DNS server


dns.cs.umass.edu
requesting host
cis.poly.edu

gaia.cs.umass.edu

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 28


DNS Name Resolution Example
 Recursive Query: root DNS server
 A host at cis.poly.edu wants IP address for gaia.cs.umass.edu

2 3
7
6
TLD DNS
server

local DNS server


dns.poly.edu 5 4

1 8

authoritative DNS server


dns.cs.umass.edu
requesting host
cis.poly.edu

gaia.cs.umass.edu
Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 29
DNS – Cont...
 Distributed database design is more preferred over centralized design to implement DNS in the
Internet.
 A single point of failure: If the DNS server crashes then the entire Internet will not stop.
 Traffic volume: With millions of device and users accessing its services from whole globe at
the same time.
 A Single DNS Server cannot handle huge DNS traffic but with distributed system its distributed
and reduce overload on server.
 Distant centralized database: A single DNS server cannot be “close to” all the querying clients.
 If it is in New York City, then all queries from Australia must travel to the other side of the globe, perhaps
over slow and congested links cause significant delays.
 Maintenance: To keep records for all Internet hosts. it would have to be updated frequently to
account for every new host.

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 30


Socket Programming
Socket Programming
 Socket is interface between application and network.
 An application creates a socket.
 Two type of socket:
▪ TCP Socket – Reliable Transmission
▪ UDP Socket – Unreliable Transmission
 Once configured the application can pass data to the socket for transmission and receive data
from the socket (transmitted through the network by some other host).

application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Internet
physical physical

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 32


Type of Socket
 SOCK_STREAM  SOCK_DGRAM
 E.g. TCP  E.g. UDP
 Reliable delivery  Unreliable delivery
 In-order guaranteed  No order guarantees
 Connection-oriented  Connection-less
 Bidirectional  Unidirectional

App D1
App

3 2 3 2
1 socket 1 D2
Dest. socket
D3

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 33


Client-Server socket interaction: UDP

server (running on serverIP) client


create socket:
create socket, port= x: clientSocket =
serverSocket = socket(AF_INET,SOCK_DGRAM)
socket(AF_INET,SOCK_DGRAM)
Create datagram with server IP and
port=x; send datagram via
read datagram from clientSocket
serverSocket

write reply to
serverSocket read datagram from
specifying clientSocket
client address,
port number close
clientSocket

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 34


Client-Server socket interaction: TCP

server (running on hostid) client


create socket,
port=x, for incoming
request:
serverSocket = socket()

wait for incoming create socket,


TCP
connection request connect to hostid, port=x
connectionSocket = connection setup clientSocket = socket()
serverSocket.accept()
send request using
read request from clientSocket
connectionSocket

write reply to
connectionSocket read reply from
clientSocket
close
connectionSocket close
clientSocket

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 35


Outline - Summary
 Principles of Computer Applications
 Browser, Web Server, Email, P2P Applications etc…
 Application Layer (TCP – UDP Services)
 Web (Web Pages – Objects like html, jpeg, mp3, etc…)
 HTTP (TCP connection, port-80, persistent & non-persistent conn.), Request & Response
Message format, Cookies, Web caches, FTP, Port-21
 E-mail (User agent, Mail Server, SMTP port - 25), POP3, IMAP
 DNS (Domain names to IP Address), hierarchy structure
 Socket programming with TCP and UDP (TCP – Sock_Stream, UDP – Sock_DGram)

Prof. Maulik D. Trivedi #3150710(CN)  Unit 2 – Application Layer 36


Computer Networks (CN)
GTU #3150710

Thank
You

Prof. Maulik Trivedi


Computer Engineering Department
Darshan Institute of Engineering & Technology, Rajkot
[email protected]
9998265805

You might also like