ClientServerModel
Download
Report
Transcript ClientServerModel
The Client Server Model And
Software Design
Lecturer: Tran Dang Hoan
Faculty of Information
Technology
Vietnam Maritime University
1
Introduction
TCP merely provides basic mechanisms used
to transfer data.
TCP/IP allows a programmer to establish
communication between two application programs
and to pass data back and forth.
TCP/IP provides peer-to-peer communication.
Clien/Server paradigm is a method to build a
network application.
2
Motivation
Because TCP/IP does not provide any
mechanisms that automatically create running
programs when a message arrives, a program
must be waiting to accept communication
before any requests arrive.
To ensure that computers are ready to
communicate, most system administrators
arrange to have communication programs start
automatically whenever OS boots. Each
program runs forever.
3
Terminology And Concept (1)
Client is an application that initiates peer-topeer communication.
Most client software consists of conventional programs.
When client is executed, it contacts a server, sends a
request, and awaits a response. When repsonses
arrives, the client continues processing.
Server is an application that waits for
incoming communication requests from client.
The server receives a client’s request, performs the
necessary computation, and returns the results to the
client.
4
Terminology And Concepts
Because server often need to access data, computation, or protocol
ports that the OS protects, server usually requires special system
privileges.
Authentication-verifying the identity of the client.
Authorization-determining whether a given client is permitted to access the
service the server supplies.
Data security-guaranteeing that data is not unintentionally revealed or
compromised.
Privacy-keeping information about an individual from unauthorized access.
Protection-guaranteeing that network applications cannot abuse system
resources.
Server is an application that waits for incoming communication
requests from client.
The server receives a client’s request, performs the necessary computation, and
returns the results to the client.
5
Terminology And Concepts (2)
Standard Vs. Nonstandard Client Software
Standard application services consist of the serivices defined by
TCP/IP and those serivices defined by TCP/IP and assigned wellknown, universally recognized protocol port identifiers. (Eg: email).
Nonstandard application is locally-defined application serivice (Eg:
an instituation’s private database system)
The distinction between standard services and nonstandard
appclication is only important when communcating outside the
local environment.
Within a given environment, system administrators usually arrange
to define serivice names in such a way that users cannot
distinguish between local and standard services.
Programmers who build network application that will be used at
other sites must understand the distinction.
6
Terminology And Concepts
Parameterization of Clients
Some client software provides more generality than others. In
particular, some client software allows the user to specify both the
remote machine on which a server operates and protocol port
number at which the server is listening.
Software that allows a user to specify a protocol port number has
more input parameters than the other software, this type of
software called fully parameterized client.
An example:
telnet machine-name port
When designing client application software, include parameters
that allow the user to fully specify the destination machine and
destination protocol port number.
7
Connectionless Vs. Connection-Oriented Servers
The two types of interaction correspond directly to the two major
transport protocols that the TCP/IP protocol suite supplies. TCP: connectionoriented, UDP: connectionless.
OS can be developed for either type of environment.
The distinction between two types of interaction is critical because it
determines the level of reliability that underlying system provides.
Connection-oriented interaction: verify that data arrives, that transmits segments that do
not. It computes a checksum over data to guarantee that it is not corrupted during
transmission. It uses sequence numbers to ensure that the data arrives in order, and
automatically eliminates duplicate packets. It provides flow control to ensure that the
sender does not transmit data faster than the receiver can consume it. TCP informs both
the client and server if the underlying network becomes inoperable for any reasons.
By contrast, clients and servers that use UDP do not have any guarantees about reliable
delivery. When a client sends a request, the request may be lost, duplicated, delayed, or
delivered out of order. Similarly, a response the server sends back to a client may be lost,
duplicated, delayed, or delivered out of order. The client and server application programs
must take appropriate actions to detect and correct such errors.
8
Connectionless Vs. Connection-Oriented Servers-continued
Application programs only use UDP if:
(1) The
(2) The
(3) The
delay
application protocol specifies that UDP must be used
application relies on hardware broadcast or multicast, or
application cannot tolerate the computational overhead or
required for TCP virtual circuits.
Summary:
When designing clien-server applications, beginners are
strongly advised to use TCP because it provides reliable,
connection-oriented communication. Programs only use
UDP if the application protocol handles reliablity, the
application requires hardware broadcast or multcicast, or
the application cannot tolerate virtual circiut overhead.
9
Stateless Vs. Stateful Server
Server maintains information about the status of ongoing
interaction with clients is called stateful server.
Server that do not keep any state information are called
stateless server.
Why we need stateful servers?
State information allow a server to remember what client requested
previously and to compute an incremental response as each new
request arrives=>efficiency, server give response quickly
Why we need stateless servers?
State information in a server can become incorrect if messages are lost,
duplicated, or delivered out of order or if the client computer crashes
and reboots. If server uses incorrect information when computing a
response, it may respond incorrectly.
10
Servers As Clients
A program can be both client and server.
Server may need to access network services
that require it to act as a client.
File server needs to obtain the time of the day so
it can stamp files with the time of access. Suppose
that the system on which it operates does not
have a time-of-day clock. To obtain a time-of-day
server, the server acts as a client by sending a
request to a time-of-day server.
11
Concurrent Processing in Client-Server Software
Concurrent Processing is the power of client-server
software, but also makes difficult to design and
built.
Concurrency refers to real or apparent
simultaneous computing.
Concurrent Processing in:
Multi-user computer system:can achieve concurrency by timesharing, a method to switch a single processor among multiple
computations quickly enough to give the appearance of
simultaneous
Multiprocessing: a design in which multiple processors performs
multiple computations simultaneously.
12
Concurrency Processing:Continued
Most client software achivieves concurrent
operation because
the underlying operating system allows users to
execute client programs concurrently
Users on many machines each execute client
software simultaneously.
An individual client program operates like any
conventional program; it does not manage
concurrency explicitly.
13
Concurrency in Servers
A single server must handle incoming requests
concurrently.
The process defines the fundamental unit of
computation. The most essential information associated
with a process is an instruction pointer that specifies
the address at which the process is executing.
Application programmers builds programs for a
concurrent environment without knowing whether the
underlying hardware consists of uniprocessor or
multiprocessor
14