0% found this document useful (0 votes)
36 views42 pages

Client Server Interaction

The document discusses client-server interaction on the internet. It explains that client-server interaction involves one application actively initiating contact as a client, while another application passively waits as a server. The client sends requests and the server sends responses. A single computer can run multiple servers to provide different services like file transfer or web pages. Each service is uniquely identified by a port number so the correct server application receives requests.

Uploaded by

Samson Mumba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views42 pages

Client Server Interaction

The document discusses client-server interaction on the internet. It explains that client-server interaction involves one application actively initiating contact as a client, while another application passively waits as a server. The client sends requests and the server sends responses. A single computer can run multiple servers to provide different services like file transfer or web pages. Each service is uniquely identified by a port number so the correct server application receives requests.

Uploaded by

Samson Mumba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

INTERNET

TECHNOLOGIES

By Dr D B Ntalasha
Course objectives
• To equip the student not only with the knowledge of how
to surf the Net, but also to understand the intricacies of
the Internet and how to develop both passive and active
web pages.
Course Outline
• Client Server Interaction
• The Socket Interface
• Name with the Domain Name System (DNS)
• Electronic mail representation and transfer
• File transfer and remote file access
• World Wide Web Pages and Browsing
• CGI technology for dynamic Web documents
• Java Technology for active Web documents
• Remote Procedure Calls (RPC) and
Middleware
• Network management and SNMP
• Network security
• Initialisation (configuration)
Unit 1 Client Server Interaction
• The Internet is a vast interconnected collection of
computer networks of many different types.
• Programs running on the computers connected to it
interact by passing messages, employing a common
means of communication.
• The design and construction of the Internet
communication mechanisms (the internet protocols) is a
major technical achievement, enabling a program running
anywhere to address messages to programs anywhere
else.
Introduction
• Internets provide a general communication
infrastructure without specifying which services will
be offered, which computers will run those services,
how the availability of services will become known, or
how services will be used - such issues are left to
application software and users.
• Protocol software does not know when to initiate
contact with, or when to accept incoming
communication from, a remote computer.
• Instead, communication across an internet requires a
pair of application programs to co-operate.
Communication Analogue
• An application on one computer attempts to communicate
with an application on another (the analogue of placing a
telephone call), and an application on the other computer
answers the incoming request (the analogue of answering
a telephone call).
• In other words, one application initiates communication
and the other accepts it.
Initializing Communication
• Protocol software does not have a mechanism
analogous to a telephone bell - there is no way for
protocol software to inform an application that
communication has arrived, and no way for an
application to agree to accept arbitrary incoming
messages.
• Instead of waiting for an arbitrary message to
arrive, an application that expects communication
must interact with protocol software before an
external source attempts to communicate.
• The application informs local protocol software that
a specific type of message is expected, and then
the application waits.
Conti
• When an incoming message matches
exactly what the application has
specified, protocol software passes
the message to the application.
• Two applications involved in a
communication can not both wait for a
message to arrive - one application
must actively initiate interaction, while
the other application waits passively.
The Client-Server Paradigm
• The paradigm of arranging for one application
program to wait for another application to initiate
communication pervades so much of distributed
computing that it has been given the name:
• client-server paradigm of interaction.
• The terms client and server refer to the two
applications involved in a communication.
• The application that actively initiates contact is
called a client, while the application that passively
waits for contact is called a server.
Characteristics of Clients and Servers
• In general, client software has the following
characteristics;
• It is an application program that becomes a client
temporarily when remote access is needed, but
performs other computation locally.
• It is invoked by a user and executes for one
session.
• It runs locally on the user's computer.
• It actively initiates contact with a server
(CONNECT primitive).
• It can access multiple services as needed.
Server Software
• In general, server software has the following
characteristics;
• It is a special-purpose program dedicated to
providing one service.
• It is invoked automatically when a system boots,
and continues to execute through many sessions.
• It runs on a shared computer.
• It waits passively for contact from arbitrary remote
clients (LISTEN primitive).
• It accepts contact from arbitrary clients, but offers
a single service.
Server
• Note that the word server is (strictly) referring to a piece of
software.
• However, a computer running one or more servers is
often (incorrectly) called a server.
• Like most application programs, a client and a server use
a transport protocol to communicate.
• The figure below illustrates a client and a server using the
TCP/IP protocol stack.
A Client and Server Illustration
Requests, responses and direction of data
flow
• Information can pass in either or both directions
between a client and a server.
• Typically, a client sends a request to a server and
the server returns a response to the client.
• In some cases, a client sends a series of
requests and the server issues a series of
responses (e.g., a database client might allow a
user to look up more than one item at a time).
• In other cases, the server provides continuous
output without any request - as soon as the client
contacts the server, the server begins sending
data (e.g., a local weather server might send
continuous weather reports with updated
temperature and barometric pressure).
Conti
• It is important to understand that servers can
accept incoming information as well as deliver
outgoing information.
• For example, most file servers are configured to
export a set of files to clients.
• That is, a client sends a request that contains the
name of a file, and the server responds by
sending a copy of the file.
• However, a file server can also be configured to
import files (i.e., to allow a client to send a copy of
a file which the server accepts and stores on
disk).
• In other words, information can flow in either or
both directions between a client and server.
Transport protocols and client-server
interaction
• Like most application programs, a client and server use a
transport protocol to communicate.
• A client or server application interacts directly with a
transport-layer protocol to establish communication and
send or receive information.
• The transport protocol then uses lower layer protocols to
send and receive individual messages.
• Thus a computer needs a complete stack of protocols to
run either a client or a server.
Multiple services on one computer
• The client and server each interact with a protocol in the
transport layer of the stack.
• A sufficiently powerful computer can run multiple servers
and clients at the same time.
• Such a computer must have the necessary hardware
resources (e.g. a fast CPU and sufficient memory) and
have an operating system capable of running multiple
applications concurrently (e.g. UNIX or Windows).
• The figure below illustrates such a setup.
Diagram
Explanation
• The computer in the middle might be running an FTP
server and a WWW server.
• Modern computers are often capable of running many
servers at the same time.
• On such systems, one server program runs for each
service being offered.
• For example, a single computer might run a file server as
well as a World Wide Web server.
• Although a computer can operate multiple servers, the
computer needs only a single physical connection to the
internet.
Conti
• Allowing a computer to operate multiple servers is useful
because the hardware can be shared by multiple
services.
• Consolidating servers on to a large, server-class
computer also helps reduce the overhead of system
administration because it results in fewer computer
systems to administer.
• Experience has shown that the demand for a server is
often sporadic - a given server can remain idle for long
periods of time.
Conti
• An idle server does not use the computer's CPU while
waiting for a request to arrive.
• Thus, if demand for services is low, consolidating servers
on a single computer can dramatically reduce cost without
significantly reducing performance.
• It is worthy noting, however, that the highest performance
is achieved by running a single server or client on each
single computer.
Identifying a Particular Service
• Transport protocols provide a mechanism that
allows a client to specify unambiguously which
service is desired.
• The mechanism assigns each service a unique
identifier, and requires both the server and client
to use the identifier.
• When a server begins execution, it registers with
the local protocol software by specifying the
identifier for the service it offers.
• When a client contacts a remote server, the client
specifies the identifier for the desired service.
Conti
• Transport protocol software on the client's machine sends
the identifier to the server's machine when making a
request.
• Transport protocol software on the server's machine uses
the identifier to determine which server program should
handle the request.
• As an example of service identification, consider the
Transmission Control Protocol (TCP).
• TCP uses 16-bit integer values known as protocol port
numbers to identify services, and assigns a unique
protocol port number to each service.
Cont
• A server specifies the protocol port number for the service
it offers, and then waits passively for communication.
• A client specifies the protocol port number of the desired
service when sending a request.
• Conceptually, TCP software on the server's computer
uses the protocol port number in an incoming message to
determine which server should receive the request.
Multiple copies of a server for a single
service
• Technically, a computer system that permits multiple
application programs to execute at the same time is said
to support concurrency, and a program that has more
than one thread of control (also called process or task) is
called a concurrent program.
• Concurrency is fundamental to the client-server model of
interaction because a concurrent server offers service to
multiple clients at the same time, without requiring each
client to wait for previous clients to finish.
Cont
• To understand why simultaneous service is
important, consider what happens if a service
requires significant time to satisfy each request.
• For example, a file transfer service allows a client
to obtain a copy of a remote file: the client sends
the name of the file in a request, and the server
returns a copy of the file.
• If a client requests a small file, the server can
send the entire file in a few milliseconds.
• However, a server may require several minutes to
transfer a file that contains a series of high-
resolution digital images.
• If a file server handles one request at a time, all
clients must wait while the server transfers a file
to one of them.
Conti
• In contrast, a concurrent file server can handle multiple
clients simultaneously.
• When a request arrives, the server assigns the request to
a thread of control that can execute concurrently with
existing threads.
• In essence, a separate copy of the server handles each
request.
• Thus, short requests can be satisfied quickly, without
waiting for long requests to complete.
Dynamic server creation
• Most concurrent servers operate dynamically.
• The server creates a new thread for each request
that arrives.
• The server program, actually, is constructed in
two parts: one that accepts requests and creates
a new thread for the request, and another that
consists of the code to handle an individual
request.
• When a concurrent server starts executing only
the first part runs.
• That is, the main server thread waits for a request
to arrive.
• When a request arrives, the main thread creates
a new service thread to handle the request.
• The service thread handles one request and then
terminates
cont
• Meanwhile, the main thread keeps the server alive - after
creating a thread to handle a request, the main thread
waits for another request to arrive.
• If N clients are using a given service on a single
computer, there are N + 1 threads providing the service:
the main thread is waiting for additional requests, and N
service threads are each interacting with a single client.
Transport protocol and unambiguous
communication
• If multiple copies of a server exist, how can a
client interact with the correct copy?
• The answer lies in the method that transport
protocols use to identify a server.
• Each service is assigned a unique identifier and
each request from a client includes the service
identifier, making it possible for transport protocol
software on the server's computer to associate
the incoming request with the correct server.
• As an example, consider the identifier used on a
TCP connection.
• TCP requires each client to choose a local
protocol port number that is not assigned to any
service.
conti
• When it sends a TCP segment, a client must
place its local protocol number in the SOURCE
PORT filed and the protocol number of the server
in the DESTINATION PORT field.
• On the server's computer, TCP uses the
combination of source and destination protocol
port numbers (as well as client and server IP
addresses) to identify a particular communication.
• Thus, messages can arrive from two or more
clients for the same service without causing a
problem.
• TCP passes each incoming segment to the copy
of the server that has agreed to handle the client.
Connection oriented and connectionless
transport
• Transport protocols support two basic forms of
communication: connection-oriented or
connectionless.
• To use a connection-oriented transport protocol,
two applications must establish a connection, and
then send data across the connection.
• For example, TCP provides a connection-oriented
interface to applications.
• When it uses TCP, an application must first request
TCP to open a connection to another application.
• Once the connection is in place, two applications
can exchange data.
• When the applications finish communicating, the
connection must be closed
cont
• The alternative to connection-oriented
communication is a connectionless interface that
permits an application to send a message to any
destination at a time.
• When using a connectionless transport protocol,
the sending application must specify a destination
with each message it sends.
• For example, in the TCP/IP protocol suite, the
User Datagram Protocol (UDP) provides
connectionless transport.
• An application using UDP can send a sequence
of messages, where each message is sent to a
different destination.
cont
• Clients and servers can use either connection-
oriented or connectionless transport protocols to
communicate.
• When using a connection-oriented transport, a
client first forms a connection to a specific server.
• The connection then stays in place while the
client sends requests and receives responses.
• When it finishes using the service, the client
closes the connection.
• Clients and servers that use connectionless
protocols exchange individual messages.
• For example, many services that use
connectionless transport require a client to send
each request in a single message, and the server
to return each response in a single message.
A service reachable through multiple
protocols
• Services need not choose between connectionless and
connection-oriented transport; it is possible to offer both.
• That is, the same service can be made available over two
or more transport protocols, with the choice of transport
left to the client.
• Allowing the use of multiple transport protocols increases
flexibility by making the service available to clients that
may not have access to a particular transport protocol.
cont
• There are two possible implementations of a
multi-protocol server.
• In the first implementation, two servers exist for
the same service.
• One server uses connectionless transport, while
the other uses connection-oriented transport.
• In the second implementation, a single server
program can interact with two or more transport
protocols.
• The server accepts requests that arrive from
either protocol, and uses the protocol in which the
request arrived when sending a response.
Complex client-server interactions
• Some of the most interesting and useful
functionality of client-server computing arises
from arbitrary interactions among clients and
servers. In particular, it should be noted that:
• A client application is not restricted to accessing a
single service. A single application can first
become a client of one service, and later become
a client of another. The client contacts a different
server (perhaps on a different computer) for each
service.
conti
• A client application is not restricted to accessing
a single server for a given service. In some
services, each server provides different
information than servers running on other
computers. For example, a date server might
provide the current time and date for the
computer on which it runs. A server on a
computer in a different time zone gives a
different answer. In other services, all servers
provide the same information. In such cases, a
client might send a request to multiple servers
to improve performance - the client uses the
information sent by the server that responds
first.
cont
• A server is not restricted from performing
further client-server interactions - a server
for one service can become a client for
another. For example, a file server that
needs to record the time that a file was
accessed might become a client of a time
server. That is, while it is handling a
request for a file, the file server sends a
request to a time server, waits for the
response, and then continues handling
the file request.
Interactions and circular dependencies
• Servers must be planned carefully to avoid circular
dependencies.
• Consider a file server that uses a time server to obtain the
current time whenever a file is accessed.
• A circular dependency can result if the time server also
uses the file server.
• For example, suppose a programmer is asked to modify
the time server so that it keeps a record of each request.
• If the programmer chooses to have the time server
become a client of the file server, a cycle can result.
• The file server becomes a client of the time server which
becomes a client of the file server, and so on.
• The result is a disaster analogous to an infinite loop in a
program.
cont
• Although dependencies among a pair of servers are easy
to spot and avoid, a larger set of dependencies may not
be obvious.
• Imagine a dependency cycle that includes a dozen
servers, each operating on a separate computer.
• If each server is maintained by a separate programmer,
the dependencies among them may be difficult to identify.
Summary
• Client-server paradigm used in almost every distributed
computation
• Client requests service when needed
• Server waits for client requests
• Servers usually run on server-class computer
• Clients and servers use transport protocols to
communicate
• Often, but not always, there is an application protocol

You might also like