Using a Web client to retrieve a page from a Web server You retrieve

advertisement
Using a Web client
to retrieve a page
from a Web server
Retrieving a Web page
Skills: none
Concepts: Web client (browser), Web server, network
connection, URL, mobile client, peer-to-peer
application
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike
3.0 License.
You retrieve pages from Web servers every day,
but may not have thought about how the
information gets to your computer. We’ll look
at that information flow in this presentation.
The presentation covers no skills, but we will
learn what a Web client or “browser” is and
what a Web server is.
The ideas of clients and servers are central to all
Internet applications, and Web client programs
are often referred to as Web “browsers” because
we use them to browse around the Web.
We’ll also cover network connections, URLs,
mobile clients and peer-to-peer applications.
Communication
technology
Where does this topic fit?
• Internet concepts
– Applications
– Technology
– Implications
• Internet skills
– Application development
– Content creation
– User skills
Video illustrating
the retrieval of a
Web page
Surfing the Web is an application, but in this
presentation we are concerned with Web
technology.
We will see what happens when you retrieve
and display a Web page.
Pause and watch this video before going on.
Watch this video
The World Wide Web in plain English (2m 46s):
http://www.commoncraft.com/world-wide-web
Network
applications involve
a client and a server.
The client is a
computer running
client software and
the server is a
computer running
server software.
There are billions of computers connected to the
Internet.
Client and server
Retrieving a Web page involves two of them.
Server
Client
One, the client, is running a Web client
program.
The other, the server, is running a Web server
program.
Web client programs are often called Web
“browsers.”
When you are surfing the Web, you use a Web
client program like Microsoft Internet Explorer
or Google Chrome.
Your Web client program waits for you to
request a page.
The Web server program is waiting for a
request.
URL – the address
of a file on the Web
Uniform resource locator (URL)
URL stands for uniform resource locator, which
is a geek term for “Web address.”
The user initiates the request by typing a URL
into the client address bar and hitting the
“Enter” key.
Let’s see what happens next.
What happens next?
Establish a
temporary
connection
The first thing the client does is establish a
temporary connection across the Internet to the
server.
Establish a temporary connection
Server
Client
Client sends a page
request
This is analogous to initiating a telephone call,
and the connection will be dropped once the
page is transferred.
Next, the client program sends a request for the
page that is specified in the URL to the server.
Request the page
Request
Server
Client
Server returns the
requested page to
the client
When the request arrives, the server finds the
page in storage and sends it back to the client.
Send the page to the client
Request
Client
page
Server
And the client displays the page when it arrives.
Client displays the
page.
Client displays the page
Request
Server
page
Client
Once the client has displayed the page, the
connection is dropped. The server goes back to
waiting for future requests, and the client waits
for the next command from the user. We are
back where we started.
Drop the connection
Drop the connection
Request
A conversation
between the client
and the server
Server
page
Client
The client-server conversation
Client
• I would like to open
a connection
Server
• OK
• GET <file name>
• Send page or
error message
• Display response
• Close connection
• OK
You can think of the transaction as a
conversation between the client and the server.
Network technicians often draw diagrams like
this one.
Tracing the data
flow
This figure summarizes the data flow.
Data flow
Client
Web
client
program
Memory
Requested
page
Server
Request
Page
Memory
The Internet
Display
If the requested file
is not on the server
Web
server
program
When the server receives request, it finds the
page in storage, then copies it to its memory
Then it sends the page across the Internet to the
memory of the client computer.
Requested
page
Storage
What if the requested page is not found?
The client then displays the page.
What happens if the client requests a page that
is not on the server?
When the server discovers the error, it is
programmed to compose a Web page with an
error message on it.
It then sends that page back to the client, which
displays it.
The client just displays whatever it gets from
the server, whether it is the expected page or an
error message.
If you retrieve a Web page that includes a link
to other pages, you can retrieve it by simply
clicking on the link.
Pages with links
Pages with links
1. Get first page
Client
Server 1
Server 2
When you do that, your client program sends a
fresh request to the server where the other page
is stored.
Mobile Web Clients
Mobile Web clients
In our example, we have imagined the Web
client as running on a typical desktop or laptop
computer, but mobile devices like smart phones
and tablets are powerful computers with Web
client programs.
Mobile Web access is increasingly common.
Peer to peer
applications – both
computers run client
software and server
software
Memory in peer-to-peer applications
Operating system
Client program
Server program
You may have heard of peer-to-peer
applications.
In a peer-to-peer application, one computer runs
both a client program and a server program,
making it both a client and a server.
File sharing is a common peer-to-peer
application.
The client can retrieve files from other servers
while the server is transferring files to other
users.
Internet service providers discourage home
users from operating servers by limiting
upstream transmission speed from homes to the
Internet.
Summary
This slide summarizes the retrieval of a Web
page.
Summary: retrieving a Web page
The user enters the page URL and hits enter.
request
page
Client
1.
2.
3.
4.
5.
Server
Establish a temporary connection between the client and server
Client sends the request to the server
Server returns the requested page or an error message
Client displays whatever the server returns
Disconnect – drop the connection
A connection is established between the client
and the server.
The client sends a request for the page to the
server, which sends back either the page or an
error message if it is not found.
The client displays whatever the server sent, and
the connection is dropped.
Then the client goes back to waiting for the next
user command.
And the server goes back to waiting for the next
request from a client.
We also described mobile Internet Web
browsers and peer to peer applications.
Questions.
Questions
Diagram.
request
page
Client
Server
Without looking back, do you recall the steps in retrieving a
Web page?
1.
2.
3.
4.
5.
Questions.
1. What happens if the user accidentally misspells the URL?
2. Can one server be handling requests from more than one client
at a time? Explain your answer.
3. If a Web page contains a link to another page, must both pages
be stored on the same server?
4. If a Web page contains a link to another page, may both pages
be stored on the same server?
5. Do the terms client and server refer to hardware or software?
Explain your answer.
Download