Module-V Application Layer
Module-V Application Layer
Client-Server Architecture
• In this architecture, there is a server and many clients distributed over the network (Figure 1.1a).
• The server is always-on while a client can be randomly run.
• The server is listening on the network and a client initializes the communication.
• Upon the requests from a client, the server provides certain services to the client.
• Usually, there is no communication between two clients.
• The server has a fixed IP address.
• A client contacts the server by sending a packet to the server's IP address.
• A server is able to communicate with many clients.
• The applications such as FTP, telnet, Web, e-mail etc use the client-server architecture.
Data Center
• Earlier, client-server architecture had a single-server host.
• But now, a single-server host is unable to keep up with all the requests from large no. of clients.
• For this reason, data-center a is used.
• A data-center contains a large number of hosts.
• A data-center is used to create a powerful virtual server.
• In date center, hundreds of servers must be powered and maintained.
• For example:
➢ Google has around 50 data-centers distributed around the world.
1
Computer Networks
P2P Architecture
• There is no dedicated server (Figure 1.1b).
• Pairs of hosts are called peers.
• The peers communicate directly with each other.
• The peers are not owned by the service-provider. Rather, the peers are laptops controlled by users.
• Many of today's most popular and traffic-intensive applications are based on P2P architecture.
• Examples include file sharing (BitTorrent), Internet telephone (Skype) etc.
• Main feature of P2P architectures: self-scalability.
• For ex: In a P2P file-sharing system,
➢ Each peer generates workload by requesting files.
➢ Each peer also adds service-capacity to the system by distributing files to other peers.
• Advantage: Cost effective ‘.’ Normally, server-infrastructure & server bandwidth are not required.
• Three challenges of the P2P applications:
1) ISP Friendly
➢ Most residential ISPs have been designed for asymmetrical bandwidth usage.
➢ Asymmetrical bandwidth means there is more downstream-traffic than upstream-traffic.
➢ But P2P applications shift upstream-traffic from servers to residential ISPs, which stress on
the ISPs.
2) Security
➢ Since the highly distribution and openness, P2P applications can be a challenge to security.
3) Incentive
➢ Success of P2P depends on convincing users to volunteer bandwidth & resources to the
applications.
2
Computer Networks
Processes Communicating
Process
• A process is an instance of a program running in a computer.(IPC inter-process communication).
• The processes may run on the 1) same system or 2) different systems.
1) The processes running on the same end-system can communicate with each other using IPC.
2) The processes running on the different end-systems can communicate by exchanging messages.
i) A sending-process creates and sends messages into the network.
ii) A receiving-process receives the messages and responds by sending messages back.
Addressing Processes
• To identify the receiving-process, two pieces of information need to be specified:
1) IP address of the destination-host.
3
Computer Networks
Throughput
• Throughput is the rate at which the sending-process can deliver bits to the receiving-process.
• Since other hosts are using the network, the throughput can fluctuate with time.
• Two types of applications:
1) Bandwidth Sensitive Applications
➢ These applications need a guaranteed throughput. For ex: Multimedia applications
➢ Some transport-protocol provides guaranteed throughput at some specified rate (r bits/sec).
2) Elastic Applications
➢ These applications may not need a guaranteed throughput. For ex: Electronic mail, File transfer &
Web transfers.
Timing
• A transport-layer protocol can provide timing-guarantees.
• For ex: guaranteeing every bit arrives at the receiver in less than 100 msec.
• Timing constraints are useful for real-time applications such as
→ Internet telephony
→ Virtual environments
→ Teleconferencing and
→ Multiplayer games
Security
• A transport-protocol can provide one or more security services.
• For example,
4
Computer Networks
TCP Services
• An application using transport-protocol TCP, receives following 2 services.
1) Connection-Oriented Service
➢ Before the start of communication, client & server need to exchange control-information.
➢ This phase is called handshaking phase.
➢ Then, the two processes can send messages to each other over the connection.
➢ After the end of communication, the applications must tear down the connection.
2) Reliable Data Transfer Service
➢ The communicating processes must deliver all data sent without error & in the proper order.
• TCP also includes a congestion-control.
• The congestion-control throttles a sending-process when the network is congested.
UDP Services
• UDP is a lightweight transport-protocol, providing minimal services.
• UDP is connectionless, so there is no handshaking before the 2 processes start to communicate.
• UDP provides an unreliable data transfer service.
• Unreliable means providing no guarantee that the message will reach the receiving-process.
• Furthermore, messages that do arrive at the receiving-process may arrive out-of-order.
• UDP does not include a congestion-control.
• UDP can pump data into the network-layer at any rate.
5
Computer Networks
Overview of HTTP
Web
• A web-page consists of objects (HTML Hyper Text Markup Language).
• An object is a file such as an HTML file, a JPEG image, a Java applet, a video chip.
• The object is addressable by a single URL (URL Uniform Resource Locator).
• Most Web-pages consist of a base HTML file & several referenced objects.
• For example:
If a Web-page contains HTML text and five JPEG images; then the Web-page has six objects:
1) Base HTML file and
2) Five images.
• The base HTML file references the other objects in the page with the object's URLs.
• URL has 2 components:
1) The hostname of the server that houses the object and
2) The object’s path name.
• For example:
“http://www.someSchool.edu/someDepartment/picture.gif”
In above URL,
1) Hostname = “www.someSchool.edu ”
2) Path name = “/someDepartment/picture.gif”.
• The web browsers implement the client-side of HTTP. For ex: Google Chrome, Internet Explorer
• The web-servers implement the server-side of HTTP. For ex: Apache
HTTP
• HTTP is Web’s application-layer protocol (Figure 1.3) (HTTP HyperText Transfer Protocol).
• HTTP defines
→ how clients request Web-pages from servers and
→ how servers transfer Web-pages to clients.
6
Computer Networks
• When a user requests a Web-page, the browser sends HTTP request to the server.
• Then, the server responds with HTTP response that contains the requested-objects.
• HTTP uses TCP as its underlying transport-protocol.
• The HTTP client first initiates a TCP connection with the server.
• After connection setup, the browser and the server-processes access TCP through their sockets.
7
Computer Networks
Figure 1.4: Back-of-the-envelope calculation for the time needed to request and receive an HTML file
• RTT is the time taken for a packet to travel from client to server and then back to the client.
• The total response time is sum of following (Figure 1.4):
i) One RTT to initiate TCP connection (RTT Round Trip Time).
8
Computer Networks
ii) One RTT for HTTP request and first few bytes of HTTP response to return.
iii) File transmission time.
i.e. Total response time = (i) + (ii) + (iii) = 1 RTT+ 1 RTT+ File transmission time
= 2(RTT) + File transmission time
9
Computer Networks
11
Computer Networks
4) Last-Modified: This line indicates the time & date when the object was last modified.
5) Content-Length: This line indicates the number of bytes in the sent-object.
6) Content-Type: This line indicates that the object in the entity body is HTMLtext.
12
Computer Networks
Web Caching
• A Web-cache is a network entity that satisfies HTTP requests on the behalf of an original Web-server.
• The Web-cache has disk-storage.
• The disk-storage contains copies of recently requested-objects.
Figure 1.8: Clients requesting objects through a Web-cache (or Proxy Server)
Figure 1.9: FTP moves files between local and remote file systems
14
Computer Networks
15
Computer Networks
16
Computer Networks
SMTP
• SMTP is the most important protocol of the email system.
• Three characteristics of SMTP (that differs from other applications):
1) Message body uses 7-bit ASCII code only.
2) Normally, no intermediate mail-servers used for sending mail.
3) Mail transmissions across multiple networks through mail relaying.
• Here is how it works:
1) Usually, mail-servers are listening at port 25.
2) The sending server initiates a TCP connection to the receiving mail-server.
3) If the receiver's server is down, the sending server will try later.
4) If connection is established, the client & the server perform application-layer handshaking.
5) Then, the client indicates the e-mail address of the sender and the recipient.
6) Finally, the client sends the message to the server over the same TCP connection.
17
Computer Networks
POP
• POP is an extremely simple mail access protocol.
• POP server will listen at port 110.
• Here is how it works:
➢ The user-agent at client's computer opens a TCP connection to the main server.
➢ POP then progresses through three phases:
1) Authentication
➢ The user-agent sends a user name and password to authenticate the user.
2) Transaction
➢ The user-agent retrieves messages.
➢ Also, the user-agent can
→ mark messages for deletion
→ remove deletion marks &
→ obtain mail statistics.
➢ The user-agent issues commands, and the server responds to each command with a reply.
➢ There are two responses:
i) +OK: used by the server to indicate that the previous command was fine.
ii) –ERR: used by the server to indicate that something is wrong.
3) Update
➢ After user issues a quit command, the mail-server removes all messages marked for deletion.
• Disadvantage:
The user cannot manage the mails at remote mail-server. For ex: user cannot delete messages.
IMAP
• IMAP is another mail access protocol, which has more features than POP.
• An IMAP server will associate each message with a folder.
18
Computer Networks
• When a message first arrives at server, the message is associated with recipient's INBOX folder
• Then, the recipient can
→ move the message into a new, user-created folder
→ read the message
→ delete the message and
→ search remote folders for messages matching specific criteria.
• An IMAP server maintains user state-information across IMAP sessions.
• IMAP permits a user-agent to obtain components of messages.
For example, a user-agent can obtain just the message header of a message.
Web-Based E-Mail
• HTTPs are now used for Web-based email accessing.
• The user-agent is an ordinary Web browser.
• The user communicates with its remote-server via HTTP.
• Now, Web-based emails are provided by many companies including Google, Yahoo etc.
19
Computer Networks
20
Computer Networks
• Suppose a client wants to determine IP address for hostname “www.amazon.com” (Figure 1.12):
1) The client first contacts one of the root servers, which returns IP addresses for TLD servers
2) Then, the client contacts one of these TLD servers.
➢ The TLD server returns the IP address of an authoritative-server for “amazon.com”.
3) Finally, the client contacts one of the authoritative-servers for amazon.com.
➢ The authoritative-server returns the IP address for the hostname “www.amazon.com”.
• The example shown in Figure 1.13 makes use of both recursive queries and iterative queries.
21
Computer Networks
• The query 1 sent from cis.poly.edu to dns.poly.edu is a recursive query. This is because
→ the query asks dns.poly.edu to obtain the mapping on its behalf.
• But the subsequent three queries 2, 4 and 6 are iterative. This is because
→ all replies are directly returned to dns.poly.edu.
22
Computer Networks
DNS Messages
• Two types of DNS messages: 1) query and 2) reply.
• Both query and reply messages have the same format.
23
Computer Networks
ii)Type
➢ This field indicates the type of question being asked about the domain-name.
3) Answer Section
• This section contains a reply from a DNS server.
• This section contains the resource-records for the name that was originally queried.
• A reply can return multiple RRs in the answer, since a hostname can have multiple IP addresses.
4) Authority Section
• This section contains records of other authoritative-servers.
5) Additional Section
• This section contains other helpful records.
24