Unit 2
Unit 2
APPLICATION LAYER
HTTP(HAYPER TEXT TRANSFER PROTOCOL)
Stateless
Because an HTTP server maintains no information about the clients, HTTP
is said to be a stateless protocol.
This simplifies server design and has permitted engineers to develop high-
performance Web servers that can handle thousands of simultaneous TCP
connections.
However, it is often desirable for a Web site to identify users, either because the
server wishes to restrict user access or because it wants to serve content as a
function of the user identity. For these purposes, HTTP uses cookies.
Suppose Susan, who always accesses the Web using Internet Explorer from her
home PC, contacts Amazon.com for the first time.
Let us suppose that in the past she has already visited the eBay site.
When the request comes into the Amazon Web server, the server creates a unique
identification number and creates an entry in its back-end database that is indexed
by the identification number.
The Amazon Web server then responds to Susan’s
browser, including in the HTTP response a Set-cookie: header, which contains
the identification number. For example, the header line might be:
Set-cookie: 1678
When Susan’s browser receives the HTTP response message, it sees the Setcookie:
header. The browser then appends a line to the special cookie file that it
manages. This line includes the hostname of the server and the identification number
in the Set-cookie:
header.
Note that the cookie file already has an entry for ebay. since Susan has visited that
site in the past. As Susan continues to browse the Amazon site, each time she
requests a Web page, her browser consults her cookie file, extracts her
identification number for this site, and puts a cookie header line that includes the
identification number in the HTTP request. Specifically, each of her HTTP requests
to the Amazon server includes the header line: Cookie: 1678
In this manner, the Amazon server is able to track Susan’s activity at the Amazon
site. Although the Amazon Web site does not necessarily know Susan’s name, it
knows exactly which pages user 1678 visited, in which order, and at what times!
Amazon uses cookies to provide its shopping cart service—Amazon can maintain a
list of all of Susan’s intended purchases, so that she can pay for them collectively at
the end of the session.
If Susan returns to Amazon’s site, say, one week later, her browser will continue
to put the header line Cookie: 1678 in the request messages. Amazon also recommends
products to Susan based on Web pages she has visited at Amazon in the
Past. If Susan also registers herself with Amazon—providing full name, e-mail
Address, postal address, and credit card information—Amazon can then include this
Information in its database, thereby associating Susan’s name with her identification
number
This is how
Amazon and other e-commerce sites provide “one-click shopping”—when
Susan chooses to purchase an item during a subsequent visit, she doesn’t
need to re-enter her name, credit card number, or address.
Web Caching
Example 20.3
In this example, we show how the client switches to the
character mode. This requires that the client request
the server to enable the SUPPRESS GO AHEAD and
ECHO options (see Figure 20.16).
•Open APIs refer to any kind of open source interfaces that both
developers and users can have access to. This type of API can also be
referred to as a public API, which, as the name implies, is shared freely
and published openly online for anyone to use.
•Partner APIs are not open to the public, and require specific
permissions in order to access or integrate them. These types of APIs
are more strategic and serve to connect B2B and B2C ventures.
•Internal APIs, also known as private APIs, are not open to any
external users. These types of APIs remain exclusive to a specific
business and are only used to improve internal communications and
development, such as payroll or HR systems.
Dr.Mrs.Kanchan Dhote
Socket
flow of data. They use the Transmission Control Protocol (TCP) for data
transmission, ensuring that data arrives in the same order it was sent 2.
2. Datagram Sockets: These are connectionless and use the User Datagram
Protocol (UDP). They do not guarantee the order of delivery or even the delivery
itself
Socket address
• A transport-layer protocol in the TCP suite
needs both the IP address and the port
number, at each end, to make a connection.
• The combination of an IP address and a port
number is called a socket address.
• The client socket address defines the client
process uniquely just as the server socket
address defines the server process uniquely as
shown in Figure.
• To use the services of transport layer in the
Internet, we need a pair of socket addresses:
the client socket address and the server
socket address.
• These four pieces of information are part of the
network-layer packet header and the transport-
layer packet header.
• The first header contains the IP addresses; the
second header contains the port numbers.
SUMMARY OF
SOCKET AND SOCKET ADDRESS
Definition
• A socket is an endpoint for communication
between two machines or processes over a
network. It allows for the exchange of data
between different processes, either on the same
machine or across different machines.
• They are created using the socket system call and provide a
bidirectional communication facility over the network.
transmission, ensuring that data arrives in the same order it was sent.
delivery itself
1. Process to process delivery (transport layer communication) needs
two identifiers, one is IP address and the other is port number at
each end to make a connection.
2. Socket address is the combinations of IP address and port number
as shown in the figure.
1. The client socket address defines the client process
uniquely whereas the server socket address defines
the server process uniquely.
2. A transport layer protocol requires the client socket
address as well as the server socket address. These
two addresses contain four pieces.
3. These four pieces go into the IP header and the
transport layer protocol header.
4. The IP header contains the IP addresses while the UDP
and TCP headers contain the port numbers.