client and server
client and server
Normally, only one user uses a specific client at a time. A client connects to a server to send and
receive information. Think of a client as a program that gets information from somewhere else.
A server is usually a large computer capable of providing data to many clients at the same time.
The word server can mean the physical computer or piece of hardware, or it can refer to the
actual server software or daemon running on that machine. A daemon is a program that offers a
service to other programs, usually over a network. It accepts requests from clients, processes the
requests, and returns the results to the requesting client. Although the client and server can be on
the same machine, they are usually on separate machines connected by some kind of network.
The World Wide Web (WWW) uses this client/server model to allow millions of users to access
Web sites all over the world. A Web server is a specific type of server that knows how to
communicate with clients using the Hyper Text Transfer Protocol (HTTP). A protocol is just a
standard set of rules that allow a client and server to communicate. For a client and server to
communicate, they must speak the same protocol. HTTP allows clients to request documents and
servers to respond with those documents. On the Web, the clients are Web browsers—
applications especially well suited for displaying HTML content. Web servers wait for clients to
connect and when a connection is established, they receive a request from the client and then
respond—usually returning a document or image. The Web server process is usually referred to
as the HTTPD, or HTTP daemon.
To connect to a server, the client must be able to communicate with it over the network.
omputers connected to the Internet typically communicate using TCP/IP (Transmission Control
Protocol and the Internet Protocol). TCP/IP allows different types of computers to communicate
at a low level; it is up to applications, however, to determine how client and server software talk
to each other. Applications such as e-mail, ftp, and Web browsers use their own protocols
(SMTP, HTTP, etc.) to communicate on the application level while using TCP/IP at the network
level. TCP/IP uses IP addresses to communicate between computers. Each computer on the
Internet has its own unique IP address. When a computer wants to send a message to another
machine on the Internet, it specifies the address of the other machine and the message finds its
way through the network. This is similar to how a letter finds its way through the postal system.
The destination computer may have many different services running on it, so to specify which
service we want to communicate with, we must use a port number. Each service has a unique
number assigned to it known as a port number. Most of the services have standard port numbers.
The main goal of any Web server is to provide documents to clients. The first Web servers were
very simple and did little more than this. Today’s Web servers are full of features that allow
them to do more than just respond to simple requests for static documents, and many provide
easy-to-use graphical user interfaces for administration and customization. Today’s servers
support options that allow the creation of dynamic documents—documents that are generated on
the fly, not stored on disk. The purpose of a Web browser is to retrieve and display information
from a Web server by using HTTP. A browser allows any user to access a server easily. Without
even knowing what a Web server is, a user can easily obtain information from one just by
entering a URL. Browsers have evolved also, adding features that far extend the capabilities of
browsers that once displayed only basic HTML.
Browser Plug-Ins
A plug-in extends the capabilities of a browser by allowing it to display more than just HTML
documents. Adobe’s Acrobat plug-in allows browsers to display PDF (Portable Document
Format) files, and Macromedia Shockwave and Flash plug-ins allow authors to embed
multimedia applications in Web pages. Plug-ins typically relies on the browser to retrieve the
content (using HTTP) and then display it themselves. Plug-ins such as Real Networks’
RealPlayer, however, is able to use their own protocols instead of HTTP to retrieve content.
RealPlayer enables browsers to play streaming audio and video, which has different
requirements than text documents, so a protocol other than HTTP is used by the plug-in to
enhance performance. Helper applications are similar to plug-ins; they allow you to view content
that your browser cannot. Unlike plug-ins, helper applications run outside the browser. They are
stand-alone applications and they cannot be used to embed content in Web pages.
Q3:- How does a hostname get translated into an address? Find out the IP address of a host
(try www.phptr.com).
Answer: When a client wants to talk to a server, it must know the IP address. A user will usually
enter a hostname rather than IP address, though, and the computer will then resolve the hostname
into an IP address that it can use. When the client makes an initial request to talk with a server, it
specifies which IP address it wants to talk with (the unique IP address of the server) and specifies
a port number. A port number is used to specify which service the client wishes to use (HTTP,
telnet, ftp, etc.). Think of this like a telephone call: a telephone number is like an IP address and
a port is an extension. Ports allow networked computers to provide many services but use only a
single address. Applications use standard port numbers to communicate. Some standard services
and ports are:
FTP 20, 21
Telnet 23
SMTP (e-mail) 25
HTTP 80
When you type a URL into a Web browser to request a Web page via HTTP, it will try to
connect to the server at port 80 unless you specify a different port number. There may be times
when you want to run a service on a nonstandard port. For instance, you might have a production
Web server running on port 80 but set up another HTTPD on port 8080 for testing purposes. On
UNIX servers, port numbers below 1024 are available only for use by programs running as the
root user (the system administrator). Ports above 1023 are available to programs running as any
normal user provided that the port is not already in use. Once a daemon starts running on a port,
any client can connect to it.
Q:- What is the primary function of an HTTP server?
Answer: The primary function of an HTTP server is to service client requests for documents. It
waits for HTTP requests and then returns data for each one. An HTTP daemon provides an
HTTP service. It allows a server to support client requests for documents. It generates errors
when invalid requests are received or when a document cannot be found. The Web server
process also generates log files of requests, errors, and other information.
Q: - What is the primary function of a Web browser?
Answer: The primary function of a Web browser is to display HTML documents. Although it
can be used to view local documents on a hard drive, it is normally used as a client to retrieve
documents from an HTTP server. Although browser software has expanded over the past few
years to include such services as e-mail and news, its primary function is to format HTML
documents for display.
Q: - What was the first Web browser? Why did it succeed where similar services (such as
ftp, gopher, and WAIS) failed?
Answer: The first real HTML browser, NCSA Mosaic, came into being in early 1993. Although
the hypertext documents had been around for some time, Mosaic had several essential features
that made it popular right from the start. First, it was free, as are most browsers even today.
Second, it was available for all major platforms: UNIX, Macintosh, and Microsoft Windows.
Third, it was easy to create content—no special software was required to write HTML, only a
text editor. Before Mosaic, only text based clients such as gopher, WAIS, telnet, and FTP were
widely available for retrieving information on the Internet. An easy-to-use GUI interface and
easy-to-create content launched the Web in the form of NCSA Mosaic clients and HTTPD
servers.