SlideShare a Scribd company logo
COMPUTER NETWORKS
18CS52
Text Books: 1.James F Kurose and Keith W Ross, Computer Networking, A Top-Down Approach, Sixth edition,
Pearson,2017 . 2. Nader F Mir, Computer and Communication Networks, 2nd Edition, Pearson, 2014.
• Internet applications- classic text-based applications, popular in the 1970s
• 1980s: text email, remote access to computers, file transfers, and
newsgroups.
• mid-1990s: killer application , the World Wide Web
• Web surfing, search, and electronic commerce, instant messaging and P2P
file sharing
• Since 2000: an explosion of popular voice and video applications, including:
voice-over-IP (VoIP) and video conferencing over IP such as Skype; user-
generated video distribution such as YouTube; and movies on demand such
as Netflix.
• multi-player online games, Second Life and World of Warcraft.
• new generation of social networking applications, such as Facebook and
Twitter, created engaging human networks on top of the Internet’s network
of routers and communication links
Principles of Network Applications
• core of network application development is writing programs
that run on different end systems and communicate with each
other over the network.
• Web application - two programs communicate with each
other: browser program running in the user’s host, Web server
program running in the Web server host.
• In P2P file-sharing system there is a program in each host that
participates in the file-sharing community.
• u need to write software that will run on multiple end systems.
• you do not need to write software that runs on network core
devices, such as routers or link-layer switches.
Principles of Network Applications
• Client-Server architecture there is an always-on host, called the server,
which services requests from many other hosts, called clients. Example :
Web application
• clients do not directly communicate with each other; for example, in the
Web application, two browsers do not directly communicate.
• Also, server has a fixed, well-known address, called an IP address.
• Because the server has a fixed, well-known address, and because the
server is always on, a client can always contact the server by sending a
packet to the server’s IP address.
• Egs: Web, FTP, Telnet, and e-mail.
• a single-server host is incapable of keeping up with all the requests from
clients. Hence a data center, housing a large number of hosts, is used to
create a powerful virtual server.
Client-Server architecture
• In a P2P architecture, there is minimal (or no) reliance on dedicated
servers in data centers.
• direct communication between pairs of intermittently connected hosts,
called peers.
• The peers are not owned by the service provider, but are instead desktops
and laptops controlled by users, residing in homes, universities, offices.
• Because the peers communicate without passing through a dedicated
server, the architecture is called peer-to-peer.
• file sharing (e.g., BitTorrent), peer-assisted download acceleration (e.g.,
Xunlei), Internet Telephony (e.g., Skype), and IPTV (e.g., Kankan and
PPstream).
• self-scalability.
• cost effective
P2P architecture
3 major challenges for P2P
1. ISP Friendly. Most residential ISPs have been
dimensioned for “asymmetrical” bandwidth usage, p2p put
significant stress on ISPs.
2. Security. Because of their highly distributed and open
nature, P2P applications can be a challenge to secure.
3.Incentives. convincing users to volunteer bandwidth,
storage, and computation resources to the applications,
which is the challenge of incentive design
Processes Communication
• Processes- may be on same host or different hosts
• Same host –IPC . Different hosts- Message passing.
• In Web, a browser process initializes contact with a Web server process; browser
process - client and the Web server process - server.
• In P2P file sharing, when Peer A asks Peer B to send a specific file, Peer A – client
and Peer B - server
• Any message sent from one process to another must go through the underlying
network.
• A process sends messages into, and receives messages from, the network through
a software interface called a socket.
• process is analogous- house and socket - its door.
• a socket is the interface between the application layer and the transport layer
within a host.
• Application Programming Interface (API) between the application and the
network. with which network applications are built.
• The application developer has control of everything on the application-layer side of
the socket but has little control of the transport-layer side of the socket.
• The only control on the transport-layer side is (1) the choice of transport protocol
and (2) ability to fix a few transport-layer parameters such as maximum buffer and
maximum segment sizes
Socket as API
Transport Services to applications
• Reliable data transfer- process-to-process
• sending process can just pass its data into the socket and know with
complete confidence that the data will arrive without errors at the
receiving process.
• Loss-tolerant applications: multimedia applications such as
conversational audio/video
• lost data might result in a small glitch in the audio/video—not a crucial
impairment.
• Throughput: rate at which the sending process can deliver bits to the
receiving process.
• application could request a guaranteed throughput of r bits/sec, and
the transport protocol would then ensure that the available
throughput is always at least r bits/sec.
• Bandwidth-sensitive applications: Applications that have
throughput requirements
• Internet telephony application encodes voice at 32 kbps
(may use adaptive coding techniques)
• Elastic applications - make use of as much, or as little,
throughput as happens to be available
• Eg: Electronic mail, file transfer, and Web transfers
Throughput requirements
Transport Services to applications contd..
• Timing : A transport-layer protocol can also provide timing guarantees.
• interactive real-time applications, such as Internet telephony, virtual
environments, teleconferencing, and multiplayer games.
• Long delays in Internet telephony- unnatural pauses in the conversation
• in a multiplayer game or virtual interactive environment, a long delay
between taking an action and seeing the response- feels less realistic
• Security: encrypt all data transmitted by the sending process, and in the
receiving host, decrypt the data before delivering the data to the receiving
process.
• Hence confidentiality provided.
• Also ,data integrity and end-point authentication.
Transport Services Provided by the Internet
• Two transport protocols available: TCP and UDP
Requirements of selected network applications
TCP Services :
1. Connection-oriented service
• handshaking procedure alerts the client and server, allowing them to prepare
for an onslaught of packets.
• TCP connection exist between the sockets of the two processes. Transmission
happens
• When the application finishes sending messages, it tears down the
connection.
2. Reliable data transfer service
• data sent without error and in the proper order.
• When one side of the application passes a stream of bytes into a socket, it can
count on TCP to deliver the same stream of bytes to the receiving socket, with
no missing or duplicate bytes.
TCP also includes a congestion-control mechanism, for the general welfare of
the Internet rather than for the direct benefit of the communicating processes
UDP Services
• UDP is a no-frills, lightweight transport protocol, providing
minimal services.
• connectionless, no handshaking etc
• provides an unreliable data transfer service
• no guarantee that the message will ever reach the receiving
process.
• messages do arrive out of order.
• does not include a congestion-control mechanism,
• sending side can pump data into the layer below at any rate it
pleases.
Popular Internet applications
• defines how an application’s processes, running on different end systems,
pass messages to each other. In particular, an application-layer protocol. It
defines:
• types of messages exchanged, for example, request messages and
response messages
• syntax of the various message types, such as the fields in the message and
how the fields are delineated.
• semantics of the fields- meaning of the information in the fields
• Rules for determining when and how a process sends messages and
responds to messages.
• Some application-layer protocols are specified in RFCs and are therefore in
the public domain.
• Eg: HTTP- RFC 2616
Application-layer protocol
The Web and HTTP
• what appeals the most to users is that the Web operates on demand.
• Users receive what they want, when they want it. unlike traditional
broadcast radio and television, which force users to tune in when the
content provider makes the content available.
• everyone can become a publisher at extremely low cost.
• Hyperlinks and search engines help us navigate through an ocean of
Web sites.
• Graphics stimulate our senses.
• Forms, JavaScript, Java applets, and many other devices enable us to
interact with pages and sites.
• YouTube, Gmail, and Facebook
HyperText Transfer Protocol (HTTP)
• Heart of the Web
• RFC 1945 and RFC 2616
• HTTP is implemented in two programs: a client program and a server program.
• on different end systems talk by exchanging HTTP messages.
• HTTP defines the structure of these messages and how the exchange happens.
• A Web page - consists of objects.
• An object is simply a file—such as an HTML file, a JPEG image, a Java applet, or a
video clip—that is addressable by a single URL.
• Web pages - a base HTML file and several referenced objects.
• For example, if a Web page contains HTML text and five JPEG images, then the Web
page has six objects: base HTML file + 5 images.
• base HTML file references the other objects in the page with the objects’ URLs.
• Each URL has two components: the hostname of the server that houses the
object and the object’s path name.
• For example, the URL http://www.jss.edu/cse/picture.gif
• www.jss.edu for a hostname and /cse/picture.gif for a path name
• Web servers - Apache and Microsoft Internet Information Server etc
• HTTP uses TCP as its underlying transport protocol.
• Once the client sends a message into its socket interface, the message is out
of the client’s hands and is “in the hands” of TCP.
• HTTP need not worry about lost data reordering etc.
• HTTP is a stateless protocol.
• If a particular client asks for the same object twice in a period of a few
seconds.. server resends the object, as it has completely forgotten what it did
earlier.
• HTTP can use both non-persistent connections and persistent connections
(default).
HyperText Transfer Protocol (HTTP)
Non-Persistent and Persistent Connections
• When client-server interaction is taking place over TCP, the application
developer needs to make an important decision
• ––should each request/response pair be sent over a separate TCP
connection
• –– or should all of the requests and their corresponding responses be
sent over the same TCP connection?
• In the former approach, the application is said to use non-persistent
connections and in the latter approach, persistent connections.
• HTTP, can use both non-persistent connections and persistent
connections.
• Although HTTP uses persistent connections in its default mode, HTTP
clients and servers can be configured to use non-persistent connections
HTTP with Non-Persistent Connections
• Let the page consists of a base HTML file and 10 JPEG images, and that all 11
of these objects reside on the same server.
• suppose the URL for the base HTML file is
http://www.someSchool.edu/someDepartment/home.index
1. client process initiates a TCP connection to the server www.someSchool.edu
on port number 80(default port number for HTTP)
2. client sends an HTTP request message to the server via its socket.
3. The request message includes the path name /someDepartment/home.index.
4. server process receives the request via its socket, retrieves the object
/someDepartment/home.index from its storage (RAM or disk), encapsulates
the object in an HTTP response message, and sends the response message to
the client via its socket.
5. server process tells TCP to close the TCP connection.
6. client receives the response message.
• TCP connection terminates.
• message indicates that the encapsulated object is an HTML file
• client extracts the file from the response message, examines the HTML file,
and finds references to the 10 JPEG objects.
7 . The first four steps are then repeated for each of the referenced JPEG
objects.
**********************************
non-persistent connections- each TCP connection is closed after the server
sends the object—the connection does not persist for other objects.
 each TCP connection transports exactly one request message and one
response message.
Thus, in this example, when a user requests the Web page, 11 TCP
connections are generated.
Back-of-the-envelope calculation
• to estimate the amount of time that elapses
from when a client requests the base HTML
file until the entire file is received by the
client.
• round-trip time (RTT)- time it takes for a
small packet to travel from client to server
and then back to the client.
• RTT includes packet-propagation delays,
packet queuing delays in intermediate routers
and switches, and packet-processing delays
• what happens when a user clicks on a
hyperlink?
• causes the browser to initiate a TCP
connection between the browser and the
Web server; involves a “three-way
handshake”.
• First, a brand-new connection must be established and maintained
for each requested object.
• For each , TCP buffers must be allocated and TCP variables must be
kept in both the client and server.
• This can place a significant burden on the Web server.
• Second, each object suffers a delivery delay of two RTTs— one RTT to
establish the TCP connection and one RTT to request and receive an
object
Non-persistent connections shortcomings
• Server leaves the TCP connection open after sending a response.
• Subsequent requests and responses between the same client and server can be
sent over the same connection.
• an entire Web page (in the example above, the base HTML file and the 10
images) can be sent over a single persistent TCP connection.
• multiple Web pages (same server to same client) over a single persistent TCP
connection.
• requests for objects can be made back-to-back, without waiting for replies to
pending requests (pipelining).
• HTTP server closes a connection when it isn’t used for a certain time
(a configurable timeout interval).
• When server receives the back-to-back requests, it sends the objects back-to-
back.
• default mode of HTTP - persistent connections with pipelining
HTTP with Persistent Connections
HTTP Message Format
• RFC 1945; RFC 2616
• two types of HTTP messages: request messages and response messages
• Typical request msg
GET /somedir/page.html HTTP/1.1
Host: www.someschool.edu
Connection: close (browser doesn’t want to bother with persistent connections)
User-agent: Mozilla/5.0 (browser Type)
Accept-language: fr
• message is written in ordinary ASCII text
• Eg message consists of five lines, each followed by a carriage return and a line
feed. N line feed ASCII is 0xa R carriage return ASCII code is 0xd.
• last line is followed by an additional carriage return and line feed
General format of an HTTP request message
• Entity body is empty with the GET method, but is used with the POST method.
• An HTTP client often uses the POST method when the user fills out a form—for
example, when a user provides search words to a search engine.
• With a POST message, user is requesting a Web page from the server, but the
specific contents of the Web page depend on what the user entered into the form
fields.
• Without using POST but by using GET
www.somesite.com/animalsearch?monkeys&bananas
• HEAD method is similar to the GET method. server responds with an HTTP
message but it leaves out the requested object.
• often used for debugging.
• The PUT method is often used in conjunction with Web publishing tools. It allows
a user to upload an object to a specific path (directory) on a specific Web server.
• The DELETE method allows a user, or an application, to delete an object on a Web
server
HTTP Response Message
HTTP/1.1 200 OK (protocol version, a status code, a corresponding status msg)
Connection: close
Date:Tue,09 Aug 2011 15:44:04 GMT (when response was created & sent by server)
Server: Apache/2.2.3 (CentOS)
Last-Modified:Tue,09 Aug 2011 15:11:03 GMT(when object created -
Server: Apache/2.2.3 (CentOS) - & or modified)
Content-Length: 6821
Content-Type: text/html
(data data data data data ...)
• has 3 sections: an initial status line, six header lines, and then entity body.
• entity body is the meat of the message—it contains the requested object itself
• Last-Modified: header is critical for object caching.
General format of an HTTP response message
Status codes of HTTP Response Message
• 200 OK: Request succeeded and the information is returned in the response
• 301 Moved Permanently: Requested object has been permanently moved;
the new URL is specified in Location: header of the response message. The
client software will automatically retrieve the new URL
• 400 Bad Request: This is a generic error code indicating that the request
could not be understood by the server
• 404 Not Found: The requested document does not exist on this server
• 505 HTTP Version Not Supported: The requested HTTP protocol version is
not supported by the server.
User-Server Interaction: Cookies
• HTTP server is stateless
• However, it is often desirable for a Web site to identify users to serve
content as a function of the user identity.
• So, HTTP uses cookies
• 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.
• Cookies are controversial because they can also be considered as an
invasion of privacy.
Web cache ( proxy server)
• A Web cache (proxy server)—is a network entity that 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.
• suppose a browser is requesting the object http://www.someschool.edu/campus.gif
 browser establishes a TCP connection to the Web cache and sends HTTP
request.
 Web cache checks to see if it has a copy of the object stored locally. If it does, the
Web cache returns the object within an HTTP response message to the client
browser.
 If it does not have the object, it opens a TCP connection to the origin server, that
is, to www.someschool.edu, sends an HTTP request .
 When the Web cache receives the object, it stores a copy in its local storage and
sends a copy, within an HTTP response message, to the client browser.
• First- substantially reduce the response time for a client request
• Second- substantially reduce traffic on an institution’s access link to the
Internet. does not have to upgrade bandwidth , thereby reducing costs.
• Furthermore, it substantially reduce Web traffic in the Internet as a whole,
thereby improving performance for all applications.
• Suppose the average object size is 1 Mbits and average request rate from
the institution’s browsers to the origin servers is 15 requests per second and
RTT is 2 seconds (internet delay)
• The traffic intensity on the LAN => (15 requests/sec) (1 Mbits/request)/(100
Mbps) = 0.15
• traffic intensity on the access link (from the Internet router to institution
router) => (15 requests/sec) (1 Mbits/request)/(15 Mbps) = 1
• Though LAN is high speed , bottleneck- access link speed
WHY Web cache?
• Increase access link speed –costly
• Therefore install a web Cache
• 0.4 (0.01 seconds) + 0.6 (2.01 seconds)
• just slightly greater than 1.2 seconds!!
• lower response time and it doesn’t
require the institution to upgrade its link
to the Internet.
The Conditional GET
• the copy of an object residing in the cache may be stale
• HTTP has a mechanism that allows a cache to verify that its objects are up to date-
conditional GET.
• request message includes an If-ModifiedSince: header line along with GET
• On the behalf of a requesting browser, a proxy cache sends a request message to a Web
server:
GET /fruit/kiwi.gif HTTP/1.1
Host: www.exotiquecuisine.com
• Web server sends a response message with the requested object to the cache:
HTTP/1.1 200 OK
Date: Sat, 8 Oct 2011 15:39:29
Server: Apache/1.3.0 (Unix)
Last-Modified: Wed, 7 Sep 2011 09:23:24
Content-Type: image/gif
data data data data data ...)
• cache forwards the object to the requesting browser but also caches the object locally. It
also stores the last-modified date along with the object.
• one week later, another browser requests the same object via the cache, and the
object is still in the cache.
GET /fruit/kiwi.gif HTTP/1.1
Host: www.exotiquecuisine.com
If-modified-since: Wed, 7 Sep 2011 09:23:24
• Suppose the object has not been modified since 7 Sep 2011 09:23:24
HTTP/1.1 304 Not Modified
Date: Sat, 15 Oct 2011 15:39:29
Server: Apache/1.3.0 (Unix)
(empty entity body)
• If modified, it includes the latest copy of object in respond msg, which cache will store
File Transfer: FTP
FTP v/s HTTP
• FTP is out-of-band, HTTP is in-band
• HTTP is stateless—it does not have to keep track of any
user state.
• FTP server must maintain state about the user.
• FTP server must associate the control connection with a
specific user account, and must keep track of the user’s
current directory as the user wanders about the remote
directory tree.
FTP Commands and Replies
• 7-bit ASCII format
• readable by people
• to delineate successive commands, a carriage return and line feed end each command
• Each command consists of four uppercase ASCII characters
• USER username: to send the user identification to the server.
• PASS password: to send the user password to the server.
• LIST: Used to ask the server to send back a list of all the files in the current remote
directory. The list of files is sent over a (new and non-persistent) data connection rather
than the control TCP connection.
• RETR filename: to retrieve a file from the current directory of the remote host
• STOR filename: to store (that is, put) a file into the current directory of the remote host
• 331 - Username OK, password required
• 125 - Data connection already open; transfer starting
• 425 - Can’t open data connection
• 452 - Error writing file
Electronic Mail in the Internet
• SMTP, defined in RFC 5321, is at
the heart of Internet electronic
mail.
• SMTP transfers messages from
senders’ mail servers to the
recipients’ mail servers. SMTP is
much older than HTTP
• it restricts the body (not just the
headers) of all mail messages to
simple 7-bit ASCII
• requires binary multimedia data to
be encoded to ASCII before being
sent over SMTP and decoded back
to binary after transmission
SMTP
1. Alice invokes her user agent for e-mail, provides Bob’s e-mail address (for example, bob@someschool.edu),
composes a message, and instructs user agent to send the message.
2. message to her mail server, where it is placed in a message queue
3. client side of SMTP, running on Alice’s mail server, sees the message in the message queue. It opens a TCP
connection to port no.25 on SMTP server running on Bob’s mail server.
4. After some initial SMTP handshaking, the SMTP client sends Alice’s message into the TCP connection.
5. At Bob’s mail server, the server side of SMTP receives the message. Bob’s mail server then places the message
in Bob’s mailbox.
6. Bob invokes his user agent to read the message at his convenience
Example transcript of messages exchanged between SMTP client (C) and server (S)
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <alice@crepes.fr>
S: 250 alice@crepes.fr ... Sender ok
C: RCPT TO: <bob@hamburger.edu>
S: 250 bob@hamburger.edu ... Recipient ok
C: DATA
S: 354 Enter mail, end with “.”
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection
Some SMTP Reply Codes
220 Service Ready
421 Service not available, closing channel
250 Requested Mail Action Ok ,completed
354 Start mail input; end with <CRLF>. <CRLF>
500 Syntax error, command Unrecognised
530 Access denied
350 mailbox unavailable
554 Transaction failed
SMTP v/s HTTP
• HTTP is mainly a pull protocol — someone loads information on a Web server
and users use HTTP to pull the information from the server
SMTP is primarily a push protocol— sending mail server pushes the file to
the receiving mail server
• SMTP requires each message, including the body of each message, to be in
7-bit ASCII format.
HTTP data does not impose this restriction.
• HTTP encapsulates each object in its own HTTP response message. Internet
mail places all of the message’s objects into one message.
Note: SMTP uses persistent connections.
• Note that Bob’s user agent can’t use SMTP to obtain the messages because obtaining the
messages is a pull operation, whereas SMTP is a PUSH protocol.
• Thus we have Post Office Protocol—Version 3 (POP3), Internet Mail Access Protocol (IMAP),
HTTP etc
How does a recipient like Bob, running a user agent on his local PC, obtain
his messages, which are sitting in a mail server within Bob’s ISP?
POP3
• simple mail access protocol.
• defined in RFC 1939
• POP3 begins when the user agent (the client) opens a TCP connection to the
mail server (the server) on port 110.
• Three phases:
1. Authorization : username and a password
2. transaction : user agent can mark messages for deletion, remove deletion
marks, and obtain mail statistics
3. update : occurs after the client has issued the quit command, ending the
POP3 session; at this time, the mail server deletes the messages that were
marked for deletion.
• user agent issues commands, and the server
responds to each command with a reply.
• There are two possible responses:
1. +OK (sometimes followed by server-to-client data),
used by the server to indicate that the previous
command was fine
2. -ERR, used by the server to indicate that something
was wrong with the previous command.
• A user agent using POP3 can often be configured to
“download and delete” or to “download and keep.”
• list, retr, and dele – commands in download and
delete.
• list, retr, dele, and quit – commands in download and
keep.
C: list
S: 1 498
S: 2 912
S: .
C: retr 1
S: (blah blah ...
S: ..........blah)
S: .
C: dele 1
C: retr 2
S: (blah blah ...
S: ..........blah)
S: .
C: dele 2
C: quit
S: +OK POP3 server signing off
POP3 transaction
IMAP
• POP3 protocol does not provide any means for a user to create remote
folders and assign messages to folders.
• Problem for a Nomadic User
• So- IMAP protocol (Internet Mail Access Protocol)-more complex than
POP3
• An IMAP server will associate each message with a folder
• when a message first arrives at the server, it is associated with the
recipient’s INBOX folder.
• recipient can move message into a new, user-created folder, read , delete
the message etc
• provides commands to allow users to create folders & move msgs from
one folder to another.
• also provides commands that allow users to search remote folders for
messages matching specific criteria.
• unlike POP3, an IMAP server maintains user state information across IMAP
sessions
• for example, the names of the folders and which messages are associated
with which folders
• commands that permit a user agent to obtain components of messages.
• Eg: user can obtain just the header of a msg or just one part of a multipart
MIME msg
• useful when there is a low-bandwidth connection
• user may not want to download all of the messages in its mailbox,
particularly avoiding long messages that might contain, for example, an
audio or video clip

More Related Content

What's hot

Error control, parity check, check sum, vrc
Error control, parity check, check sum, vrcError control, parity check, check sum, vrc
Error control, parity check, check sum, vrc
Huawei Technologies
 

What's hot (20)

TCP/IP Introduction
TCP/IP IntroductionTCP/IP Introduction
TCP/IP Introduction
 
Domain name system (dns)
Domain name system (dns)Domain name system (dns)
Domain name system (dns)
 
Unit 6 : Application Layer
Unit 6 : Application LayerUnit 6 : Application Layer
Unit 6 : Application Layer
 
Application Layer
Application LayerApplication Layer
Application Layer
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes Everything
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
 
DNS Presentation
DNS PresentationDNS Presentation
DNS Presentation
 
Multicast QUIC for video content delivery
Multicast QUIC for video content deliveryMulticast QUIC for video content delivery
Multicast QUIC for video content delivery
 
Dns resource record
Dns resource recordDns resource record
Dns resource record
 
Introduction to DNS
Introduction to DNSIntroduction to DNS
Introduction to DNS
 
Application layer
Application layerApplication layer
Application layer
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Streaming Stored Video- Computer Networking
Streaming Stored Video- Computer Networking  Streaming Stored Video- Computer Networking
Streaming Stored Video- Computer Networking
 
Ipv6
Ipv6Ipv6
Ipv6
 
FTP Client and Server | Computer Science
FTP Client and Server | Computer ScienceFTP Client and Server | Computer Science
FTP Client and Server | Computer Science
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
Qos Quality of services
Qos   Quality of services Qos   Quality of services
Qos Quality of services
 
Domain name system
Domain name systemDomain name system
Domain name system
 
Error control, parity check, check sum, vrc
Error control, parity check, check sum, vrcError control, parity check, check sum, vrc
Error control, parity check, check sum, vrc
 
Http
HttpHttp
Http
 

Similar to Computer Networks Module 1-part 1.pdf

Internet and web by Gulshan K Maheshwari(QAU)
Internet and web by Gulshan  K Maheshwari(QAU)Internet and web by Gulshan  K Maheshwari(QAU)
Internet and web by Gulshan K Maheshwari(QAU)
GulshanKumar368
 
Web essentials clients, servers and communication – the internet – basic inte...
Web essentials clients, servers and communication – the internet – basic inte...Web essentials clients, servers and communication – the internet – basic inte...
Web essentials clients, servers and communication – the internet – basic inte...
smitha273566
 
Computer Networks
Computer NetworksComputer Networks
Computer Networks
Shylesh BC
 
Computer Networks notes 5- Module 5.pptx
Computer Networks notes 5- Module 5.pptxComputer Networks notes 5- Module 5.pptx
Computer Networks notes 5- Module 5.pptx
SmithaV19
 
How the internet works
How the internet worksHow the internet works
How the internet works
ftcim
 

Similar to Computer Networks Module 1-part 1.pdf (20)

CS-324-6-3 (1).pdf
CS-324-6-3 (1).pdfCS-324-6-3 (1).pdf
CS-324-6-3 (1).pdf
 
CS-324-6-3 (2).pdf
CS-324-6-3 (2).pdfCS-324-6-3 (2).pdf
CS-324-6-3 (2).pdf
 
COMPUTER NW2 (1).pptx
COMPUTER NW2 (1).pptxCOMPUTER NW2 (1).pptx
COMPUTER NW2 (1).pptx
 
web world wide defination introduction.pptx
web world wide defination introduction.pptxweb world wide defination introduction.pptx
web world wide defination introduction.pptx
 
Unit 1 web technology uptu slide
Unit 1 web technology uptu slideUnit 1 web technology uptu slide
Unit 1 web technology uptu slide
 
Internet and web by Gulshan K Maheshwari(QAU)
Internet and web by Gulshan  K Maheshwari(QAU)Internet and web by Gulshan  K Maheshwari(QAU)
Internet and web by Gulshan K Maheshwari(QAU)
 
applayer.pptx
applayer.pptxapplayer.pptx
applayer.pptx
 
Module 1 Basic.pptx
Module 1 Basic.pptxModule 1 Basic.pptx
Module 1 Basic.pptx
 
Web essentials clients, servers and communication – the internet – basic inte...
Web essentials clients, servers and communication – the internet – basic inte...Web essentials clients, servers and communication – the internet – basic inte...
Web essentials clients, servers and communication – the internet – basic inte...
 
CS8651 Internet Programming - Basics of HTML, HTML5, CSS
CS8651   Internet Programming - Basics of HTML, HTML5, CSSCS8651   Internet Programming - Basics of HTML, HTML5, CSS
CS8651 Internet Programming - Basics of HTML, HTML5, CSS
 
Networks-Internet-and-Internet-Protocols.pptx
Networks-Internet-and-Internet-Protocols.pptxNetworks-Internet-and-Internet-Protocols.pptx
Networks-Internet-and-Internet-Protocols.pptx
 
Computer Networks
Computer NetworksComputer Networks
Computer Networks
 
Computer Networks notes 5- Module 5.pptx
Computer Networks notes 5- Module 5.pptxComputer Networks notes 5- Module 5.pptx
Computer Networks notes 5- Module 5.pptx
 
Introduction to the Internet and Web.pptx
Introduction to the Internet and Web.pptxIntroduction to the Internet and Web.pptx
Introduction to the Internet and Web.pptx
 
Internet unit 4
Internet unit 4Internet unit 4
Internet unit 4
 
MODULE-5_CCN.pptx
MODULE-5_CCN.pptxMODULE-5_CCN.pptx
MODULE-5_CCN.pptx
 
How the internet works
How the internet worksHow the internet works
How the internet works
 
Unit 4
Unit 4Unit 4
Unit 4
 
APPLICATION LAYER PROTOCOLS .pptx
APPLICATION LAYER PROTOCOLS         .pptxAPPLICATION LAYER PROTOCOLS         .pptx
APPLICATION LAYER PROTOCOLS .pptx
 
Web technology
Web technologyWeb technology
Web technology
 

Recently uploaded

Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
Kamal Acharya
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
Kamal Acharya
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdf
Kamal Acharya
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DrGurudutt
 

Recently uploaded (20)

Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdf
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
 
An improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technologyAn improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technology
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptx
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdf
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
 
Lect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptxLect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptx
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 

Computer Networks Module 1-part 1.pdf

  • 1. COMPUTER NETWORKS 18CS52 Text Books: 1.James F Kurose and Keith W Ross, Computer Networking, A Top-Down Approach, Sixth edition, Pearson,2017 . 2. Nader F Mir, Computer and Communication Networks, 2nd Edition, Pearson, 2014.
  • 2.
  • 3.
  • 4. • Internet applications- classic text-based applications, popular in the 1970s • 1980s: text email, remote access to computers, file transfers, and newsgroups. • mid-1990s: killer application , the World Wide Web • Web surfing, search, and electronic commerce, instant messaging and P2P file sharing • Since 2000: an explosion of popular voice and video applications, including: voice-over-IP (VoIP) and video conferencing over IP such as Skype; user- generated video distribution such as YouTube; and movies on demand such as Netflix. • multi-player online games, Second Life and World of Warcraft. • new generation of social networking applications, such as Facebook and Twitter, created engaging human networks on top of the Internet’s network of routers and communication links Principles of Network Applications
  • 5. • core of network application development is writing programs that run on different end systems and communicate with each other over the network. • Web application - two programs communicate with each other: browser program running in the user’s host, Web server program running in the Web server host. • In P2P file-sharing system there is a program in each host that participates in the file-sharing community. • u need to write software that will run on multiple end systems. • you do not need to write software that runs on network core devices, such as routers or link-layer switches. Principles of Network Applications
  • 6.
  • 7. • Client-Server architecture there is an always-on host, called the server, which services requests from many other hosts, called clients. Example : Web application • clients do not directly communicate with each other; for example, in the Web application, two browsers do not directly communicate. • Also, server has a fixed, well-known address, called an IP address. • Because the server has a fixed, well-known address, and because the server is always on, a client can always contact the server by sending a packet to the server’s IP address. • Egs: Web, FTP, Telnet, and e-mail. • a single-server host is incapable of keeping up with all the requests from clients. Hence a data center, housing a large number of hosts, is used to create a powerful virtual server. Client-Server architecture
  • 8. • In a P2P architecture, there is minimal (or no) reliance on dedicated servers in data centers. • direct communication between pairs of intermittently connected hosts, called peers. • The peers are not owned by the service provider, but are instead desktops and laptops controlled by users, residing in homes, universities, offices. • Because the peers communicate without passing through a dedicated server, the architecture is called peer-to-peer. • file sharing (e.g., BitTorrent), peer-assisted download acceleration (e.g., Xunlei), Internet Telephony (e.g., Skype), and IPTV (e.g., Kankan and PPstream). • self-scalability. • cost effective P2P architecture
  • 9. 3 major challenges for P2P 1. ISP Friendly. Most residential ISPs have been dimensioned for “asymmetrical” bandwidth usage, p2p put significant stress on ISPs. 2. Security. Because of their highly distributed and open nature, P2P applications can be a challenge to secure. 3.Incentives. convincing users to volunteer bandwidth, storage, and computation resources to the applications, which is the challenge of incentive design
  • 10. Processes Communication • Processes- may be on same host or different hosts • Same host –IPC . Different hosts- Message passing. • In Web, a browser process initializes contact with a Web server process; browser process - client and the Web server process - server. • In P2P file sharing, when Peer A asks Peer B to send a specific file, Peer A – client and Peer B - server • Any message sent from one process to another must go through the underlying network. • A process sends messages into, and receives messages from, the network through a software interface called a socket. • process is analogous- house and socket - its door. • a socket is the interface between the application layer and the transport layer within a host. • Application Programming Interface (API) between the application and the network. with which network applications are built.
  • 11. • The application developer has control of everything on the application-layer side of the socket but has little control of the transport-layer side of the socket. • The only control on the transport-layer side is (1) the choice of transport protocol and (2) ability to fix a few transport-layer parameters such as maximum buffer and maximum segment sizes Socket as API
  • 12. Transport Services to applications • Reliable data transfer- process-to-process • sending process can just pass its data into the socket and know with complete confidence that the data will arrive without errors at the receiving process. • Loss-tolerant applications: multimedia applications such as conversational audio/video • lost data might result in a small glitch in the audio/video—not a crucial impairment. • Throughput: rate at which the sending process can deliver bits to the receiving process. • application could request a guaranteed throughput of r bits/sec, and the transport protocol would then ensure that the available throughput is always at least r bits/sec.
  • 13. • Bandwidth-sensitive applications: Applications that have throughput requirements • Internet telephony application encodes voice at 32 kbps (may use adaptive coding techniques) • Elastic applications - make use of as much, or as little, throughput as happens to be available • Eg: Electronic mail, file transfer, and Web transfers Throughput requirements
  • 14. Transport Services to applications contd.. • Timing : A transport-layer protocol can also provide timing guarantees. • interactive real-time applications, such as Internet telephony, virtual environments, teleconferencing, and multiplayer games. • Long delays in Internet telephony- unnatural pauses in the conversation • in a multiplayer game or virtual interactive environment, a long delay between taking an action and seeing the response- feels less realistic • Security: encrypt all data transmitted by the sending process, and in the receiving host, decrypt the data before delivering the data to the receiving process. • Hence confidentiality provided. • Also ,data integrity and end-point authentication.
  • 15. Transport Services Provided by the Internet • Two transport protocols available: TCP and UDP Requirements of selected network applications
  • 16. TCP Services : 1. Connection-oriented service • handshaking procedure alerts the client and server, allowing them to prepare for an onslaught of packets. • TCP connection exist between the sockets of the two processes. Transmission happens • When the application finishes sending messages, it tears down the connection. 2. Reliable data transfer service • data sent without error and in the proper order. • When one side of the application passes a stream of bytes into a socket, it can count on TCP to deliver the same stream of bytes to the receiving socket, with no missing or duplicate bytes. TCP also includes a congestion-control mechanism, for the general welfare of the Internet rather than for the direct benefit of the communicating processes
  • 17. UDP Services • UDP is a no-frills, lightweight transport protocol, providing minimal services. • connectionless, no handshaking etc • provides an unreliable data transfer service • no guarantee that the message will ever reach the receiving process. • messages do arrive out of order. • does not include a congestion-control mechanism, • sending side can pump data into the layer below at any rate it pleases.
  • 19. • defines how an application’s processes, running on different end systems, pass messages to each other. In particular, an application-layer protocol. It defines: • types of messages exchanged, for example, request messages and response messages • syntax of the various message types, such as the fields in the message and how the fields are delineated. • semantics of the fields- meaning of the information in the fields • Rules for determining when and how a process sends messages and responds to messages. • Some application-layer protocols are specified in RFCs and are therefore in the public domain. • Eg: HTTP- RFC 2616 Application-layer protocol
  • 20. The Web and HTTP • what appeals the most to users is that the Web operates on demand. • Users receive what they want, when they want it. unlike traditional broadcast radio and television, which force users to tune in when the content provider makes the content available. • everyone can become a publisher at extremely low cost. • Hyperlinks and search engines help us navigate through an ocean of Web sites. • Graphics stimulate our senses. • Forms, JavaScript, Java applets, and many other devices enable us to interact with pages and sites. • YouTube, Gmail, and Facebook
  • 21. HyperText Transfer Protocol (HTTP) • Heart of the Web • RFC 1945 and RFC 2616 • HTTP is implemented in two programs: a client program and a server program. • on different end systems talk by exchanging HTTP messages. • HTTP defines the structure of these messages and how the exchange happens. • A Web page - consists of objects. • An object is simply a file—such as an HTML file, a JPEG image, a Java applet, or a video clip—that is addressable by a single URL. • Web pages - a base HTML file and several referenced objects. • For example, if a Web page contains HTML text and five JPEG images, then the Web page has six objects: base HTML file + 5 images. • base HTML file references the other objects in the page with the objects’ URLs.
  • 22. • Each URL has two components: the hostname of the server that houses the object and the object’s path name. • For example, the URL http://www.jss.edu/cse/picture.gif • www.jss.edu for a hostname and /cse/picture.gif for a path name • Web servers - Apache and Microsoft Internet Information Server etc
  • 23. • HTTP uses TCP as its underlying transport protocol. • Once the client sends a message into its socket interface, the message is out of the client’s hands and is “in the hands” of TCP. • HTTP need not worry about lost data reordering etc. • HTTP is a stateless protocol. • If a particular client asks for the same object twice in a period of a few seconds.. server resends the object, as it has completely forgotten what it did earlier. • HTTP can use both non-persistent connections and persistent connections (default). HyperText Transfer Protocol (HTTP)
  • 24. Non-Persistent and Persistent Connections • When client-server interaction is taking place over TCP, the application developer needs to make an important decision • ––should each request/response pair be sent over a separate TCP connection • –– or should all of the requests and their corresponding responses be sent over the same TCP connection? • In the former approach, the application is said to use non-persistent connections and in the latter approach, persistent connections. • HTTP, can use both non-persistent connections and persistent connections. • Although HTTP uses persistent connections in its default mode, HTTP clients and servers can be configured to use non-persistent connections
  • 25. HTTP with Non-Persistent Connections • Let the page consists of a base HTML file and 10 JPEG images, and that all 11 of these objects reside on the same server. • suppose the URL for the base HTML file is http://www.someSchool.edu/someDepartment/home.index 1. client process initiates a TCP connection to the server www.someSchool.edu on port number 80(default port number for HTTP) 2. client sends an HTTP request message to the server via its socket. 3. The request message includes the path name /someDepartment/home.index. 4. server process receives the request via its socket, retrieves the object /someDepartment/home.index from its storage (RAM or disk), encapsulates the object in an HTTP response message, and sends the response message to the client via its socket.
  • 26. 5. server process tells TCP to close the TCP connection. 6. client receives the response message. • TCP connection terminates. • message indicates that the encapsulated object is an HTML file • client extracts the file from the response message, examines the HTML file, and finds references to the 10 JPEG objects. 7 . The first four steps are then repeated for each of the referenced JPEG objects. ********************************** non-persistent connections- each TCP connection is closed after the server sends the object—the connection does not persist for other objects.  each TCP connection transports exactly one request message and one response message. Thus, in this example, when a user requests the Web page, 11 TCP connections are generated.
  • 27. Back-of-the-envelope calculation • to estimate the amount of time that elapses from when a client requests the base HTML file until the entire file is received by the client. • round-trip time (RTT)- time it takes for a small packet to travel from client to server and then back to the client. • RTT includes packet-propagation delays, packet queuing delays in intermediate routers and switches, and packet-processing delays • what happens when a user clicks on a hyperlink? • causes the browser to initiate a TCP connection between the browser and the Web server; involves a “three-way handshake”.
  • 28. • First, a brand-new connection must be established and maintained for each requested object. • For each , TCP buffers must be allocated and TCP variables must be kept in both the client and server. • This can place a significant burden on the Web server. • Second, each object suffers a delivery delay of two RTTs— one RTT to establish the TCP connection and one RTT to request and receive an object Non-persistent connections shortcomings
  • 29. • Server leaves the TCP connection open after sending a response. • Subsequent requests and responses between the same client and server can be sent over the same connection. • an entire Web page (in the example above, the base HTML file and the 10 images) can be sent over a single persistent TCP connection. • multiple Web pages (same server to same client) over a single persistent TCP connection. • requests for objects can be made back-to-back, without waiting for replies to pending requests (pipelining). • HTTP server closes a connection when it isn’t used for a certain time (a configurable timeout interval). • When server receives the back-to-back requests, it sends the objects back-to- back. • default mode of HTTP - persistent connections with pipelining HTTP with Persistent Connections
  • 30. HTTP Message Format • RFC 1945; RFC 2616 • two types of HTTP messages: request messages and response messages • Typical request msg GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu Connection: close (browser doesn’t want to bother with persistent connections) User-agent: Mozilla/5.0 (browser Type) Accept-language: fr • message is written in ordinary ASCII text • Eg message consists of five lines, each followed by a carriage return and a line feed. N line feed ASCII is 0xa R carriage return ASCII code is 0xd. • last line is followed by an additional carriage return and line feed
  • 31. General format of an HTTP request message
  • 32. • Entity body is empty with the GET method, but is used with the POST method. • An HTTP client often uses the POST method when the user fills out a form—for example, when a user provides search words to a search engine. • With a POST message, user is requesting a Web page from the server, but the specific contents of the Web page depend on what the user entered into the form fields. • Without using POST but by using GET www.somesite.com/animalsearch?monkeys&bananas • HEAD method is similar to the GET method. server responds with an HTTP message but it leaves out the requested object. • often used for debugging. • The PUT method is often used in conjunction with Web publishing tools. It allows a user to upload an object to a specific path (directory) on a specific Web server. • The DELETE method allows a user, or an application, to delete an object on a Web server
  • 33. HTTP Response Message HTTP/1.1 200 OK (protocol version, a status code, a corresponding status msg) Connection: close Date:Tue,09 Aug 2011 15:44:04 GMT (when response was created & sent by server) Server: Apache/2.2.3 (CentOS) Last-Modified:Tue,09 Aug 2011 15:11:03 GMT(when object created - Server: Apache/2.2.3 (CentOS) - & or modified) Content-Length: 6821 Content-Type: text/html (data data data data data ...) • has 3 sections: an initial status line, six header lines, and then entity body. • entity body is the meat of the message—it contains the requested object itself • Last-Modified: header is critical for object caching.
  • 34. General format of an HTTP response message
  • 35. Status codes of HTTP Response Message • 200 OK: Request succeeded and the information is returned in the response • 301 Moved Permanently: Requested object has been permanently moved; the new URL is specified in Location: header of the response message. The client software will automatically retrieve the new URL • 400 Bad Request: This is a generic error code indicating that the request could not be understood by the server • 404 Not Found: The requested document does not exist on this server • 505 HTTP Version Not Supported: The requested HTTP protocol version is not supported by the server.
  • 36. User-Server Interaction: Cookies • HTTP server is stateless • However, it is often desirable for a Web site to identify users to serve content as a function of the user identity. • So, HTTP uses cookies • 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. • Cookies are controversial because they can also be considered as an invasion of privacy.
  • 37.
  • 38. Web cache ( proxy server) • A Web cache (proxy server)—is a network entity that 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. • suppose a browser is requesting the object http://www.someschool.edu/campus.gif  browser establishes a TCP connection to the Web cache and sends HTTP request.  Web cache checks to see if it has a copy of the object stored locally. If it does, the Web cache returns the object within an HTTP response message to the client browser.  If it does not have the object, it opens a TCP connection to the origin server, that is, to www.someschool.edu, sends an HTTP request .  When the Web cache receives the object, it stores a copy in its local storage and sends a copy, within an HTTP response message, to the client browser.
  • 39. • First- substantially reduce the response time for a client request • Second- substantially reduce traffic on an institution’s access link to the Internet. does not have to upgrade bandwidth , thereby reducing costs. • Furthermore, it substantially reduce Web traffic in the Internet as a whole, thereby improving performance for all applications. • Suppose the average object size is 1 Mbits and average request rate from the institution’s browsers to the origin servers is 15 requests per second and RTT is 2 seconds (internet delay) • The traffic intensity on the LAN => (15 requests/sec) (1 Mbits/request)/(100 Mbps) = 0.15 • traffic intensity on the access link (from the Internet router to institution router) => (15 requests/sec) (1 Mbits/request)/(15 Mbps) = 1 • Though LAN is high speed , bottleneck- access link speed WHY Web cache?
  • 40.
  • 41. • Increase access link speed –costly • Therefore install a web Cache • 0.4 (0.01 seconds) + 0.6 (2.01 seconds) • just slightly greater than 1.2 seconds!! • lower response time and it doesn’t require the institution to upgrade its link to the Internet.
  • 42. The Conditional GET • the copy of an object residing in the cache may be stale • HTTP has a mechanism that allows a cache to verify that its objects are up to date- conditional GET. • request message includes an If-ModifiedSince: header line along with GET • On the behalf of a requesting browser, a proxy cache sends a request message to a Web server: GET /fruit/kiwi.gif HTTP/1.1 Host: www.exotiquecuisine.com • Web server sends a response message with the requested object to the cache: HTTP/1.1 200 OK Date: Sat, 8 Oct 2011 15:39:29 Server: Apache/1.3.0 (Unix) Last-Modified: Wed, 7 Sep 2011 09:23:24 Content-Type: image/gif data data data data data ...) • cache forwards the object to the requesting browser but also caches the object locally. It also stores the last-modified date along with the object.
  • 43. • one week later, another browser requests the same object via the cache, and the object is still in the cache. GET /fruit/kiwi.gif HTTP/1.1 Host: www.exotiquecuisine.com If-modified-since: Wed, 7 Sep 2011 09:23:24 • Suppose the object has not been modified since 7 Sep 2011 09:23:24 HTTP/1.1 304 Not Modified Date: Sat, 15 Oct 2011 15:39:29 Server: Apache/1.3.0 (Unix) (empty entity body) • If modified, it includes the latest copy of object in respond msg, which cache will store
  • 45. FTP v/s HTTP • FTP is out-of-band, HTTP is in-band • HTTP is stateless—it does not have to keep track of any user state. • FTP server must maintain state about the user. • FTP server must associate the control connection with a specific user account, and must keep track of the user’s current directory as the user wanders about the remote directory tree.
  • 46. FTP Commands and Replies • 7-bit ASCII format • readable by people • to delineate successive commands, a carriage return and line feed end each command • Each command consists of four uppercase ASCII characters • USER username: to send the user identification to the server. • PASS password: to send the user password to the server. • LIST: Used to ask the server to send back a list of all the files in the current remote directory. The list of files is sent over a (new and non-persistent) data connection rather than the control TCP connection. • RETR filename: to retrieve a file from the current directory of the remote host • STOR filename: to store (that is, put) a file into the current directory of the remote host • 331 - Username OK, password required • 125 - Data connection already open; transfer starting • 425 - Can’t open data connection • 452 - Error writing file
  • 47. Electronic Mail in the Internet • SMTP, defined in RFC 5321, is at the heart of Internet electronic mail. • SMTP transfers messages from senders’ mail servers to the recipients’ mail servers. SMTP is much older than HTTP • it restricts the body (not just the headers) of all mail messages to simple 7-bit ASCII • requires binary multimedia data to be encoded to ASCII before being sent over SMTP and decoded back to binary after transmission
  • 48. SMTP 1. Alice invokes her user agent for e-mail, provides Bob’s e-mail address (for example, bob@someschool.edu), composes a message, and instructs user agent to send the message. 2. message to her mail server, where it is placed in a message queue 3. client side of SMTP, running on Alice’s mail server, sees the message in the message queue. It opens a TCP connection to port no.25 on SMTP server running on Bob’s mail server. 4. After some initial SMTP handshaking, the SMTP client sends Alice’s message into the TCP connection. 5. At Bob’s mail server, the server side of SMTP receives the message. Bob’s mail server then places the message in Bob’s mailbox. 6. Bob invokes his user agent to read the message at his convenience
  • 49. Example transcript of messages exchanged between SMTP client (C) and server (S) S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <alice@crepes.fr> S: 250 alice@crepes.fr ... Sender ok C: RCPT TO: <bob@hamburger.edu> S: 250 bob@hamburger.edu ... Recipient ok C: DATA S: 354 Enter mail, end with “.” C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection
  • 50. Some SMTP Reply Codes 220 Service Ready 421 Service not available, closing channel 250 Requested Mail Action Ok ,completed 354 Start mail input; end with <CRLF>. <CRLF> 500 Syntax error, command Unrecognised 530 Access denied 350 mailbox unavailable 554 Transaction failed
  • 51. SMTP v/s HTTP • HTTP is mainly a pull protocol — someone loads information on a Web server and users use HTTP to pull the information from the server SMTP is primarily a push protocol— sending mail server pushes the file to the receiving mail server • SMTP requires each message, including the body of each message, to be in 7-bit ASCII format. HTTP data does not impose this restriction. • HTTP encapsulates each object in its own HTTP response message. Internet mail places all of the message’s objects into one message. Note: SMTP uses persistent connections.
  • 52. • Note that Bob’s user agent can’t use SMTP to obtain the messages because obtaining the messages is a pull operation, whereas SMTP is a PUSH protocol. • Thus we have Post Office Protocol—Version 3 (POP3), Internet Mail Access Protocol (IMAP), HTTP etc How does a recipient like Bob, running a user agent on his local PC, obtain his messages, which are sitting in a mail server within Bob’s ISP?
  • 53. POP3 • simple mail access protocol. • defined in RFC 1939 • POP3 begins when the user agent (the client) opens a TCP connection to the mail server (the server) on port 110. • Three phases: 1. Authorization : username and a password 2. transaction : user agent can mark messages for deletion, remove deletion marks, and obtain mail statistics 3. update : occurs after the client has issued the quit command, ending the POP3 session; at this time, the mail server deletes the messages that were marked for deletion.
  • 54. • user agent issues commands, and the server responds to each command with a reply. • There are two possible responses: 1. +OK (sometimes followed by server-to-client data), used by the server to indicate that the previous command was fine 2. -ERR, used by the server to indicate that something was wrong with the previous command. • A user agent using POP3 can often be configured to “download and delete” or to “download and keep.” • list, retr, and dele – commands in download and delete. • list, retr, dele, and quit – commands in download and keep. C: list S: 1 498 S: 2 912 S: . C: retr 1 S: (blah blah ... S: ..........blah) S: . C: dele 1 C: retr 2 S: (blah blah ... S: ..........blah) S: . C: dele 2 C: quit S: +OK POP3 server signing off POP3 transaction
  • 55. IMAP • POP3 protocol does not provide any means for a user to create remote folders and assign messages to folders. • Problem for a Nomadic User • So- IMAP protocol (Internet Mail Access Protocol)-more complex than POP3 • An IMAP server will associate each message with a folder • when a message first arrives at the server, it is associated with the recipient’s INBOX folder. • recipient can move message into a new, user-created folder, read , delete the message etc • provides commands to allow users to create folders & move msgs from one folder to another. • also provides commands that allow users to search remote folders for messages matching specific criteria.
  • 56. • unlike POP3, an IMAP server maintains user state information across IMAP sessions • for example, the names of the folders and which messages are associated with which folders • commands that permit a user agent to obtain components of messages. • Eg: user can obtain just the header of a msg or just one part of a multipart MIME msg • useful when there is a low-bandwidth connection • user may not want to download all of the messages in its mailbox, particularly avoiding long messages that might contain, for example, an audio or video clip