Lecture 20 - Client-Server Model
Lecture 20 - Client-Server Model
Application Layer
and
Client-Server Model
CLIENT-SERVER MODEL
CONCURRENCY
PROCESSES
1
©The McGraw-Hill Companies, Inc., 2000 1 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Comparison between OSI and TCP/IP
2
©The McGraw-Hill Companies, Inc., 2000 2 © Adapted for use at JMU by Mohamed Aboutabl, 2003
15.1 Client-server model
3
©The McGraw-Hill Companies, Inc., 2000 3 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Client-Server Relationship: Many-to-One
Servers
Run all the time (i.e. infinite)
Provide service to any client
Typically specialize in providing
a certain type of service, e.g.
Mail.
Listen to a well-known port and
passively open connection.
Clients
Run when needed, then
terminate (i.e. finite)
Actively Open TCP or UDP
connection with Server’s socket.
4
©The McGraw-Hill Companies, Inc., 2000 4 © Adapted for use at JMU by Mohamed Aboutabl, 2003
15.1 Concurrency
In servers:
Iterative mode: serve one client at-a-time (clients wait in a queue)
independently.
In addition, servers could chose the Transport layer protocol:
UDP, i.e. connectionless
5
©The McGraw-Hill Companies, Inc., 2000 5 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Server types
Transport Protocol Operation Mode
6
©The McGraw-Hill Companies, Inc., 2000 6 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Connectionless iterative server
7
©The McGraw-Hill Companies, Inc., 2000 7 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Connection-Oriented Concurrent Server
Requests and responses are streams of data
spanning several segments.
8
©The McGraw-Hill Companies, Inc., 2000 8 © Adapted for use at JMU by Mohamed Aboutabl, 2003
15.3 Programs and Processes
Name.
Where is the data
9
©The McGraw-Hill Companies, Inc., 2000 9 © Adapted for use at JMU by Mohamed Aboutabl, 2003
The Process ID & getpid()
10
©The McGraw-Hill Companies, Inc., 2000 10 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Process Creation & fork()
By Replication
One-Parent
needed
After the fork(),
both parent and
child processes
execute the same
line, the one after
the fork()
11
©The McGraw-Hill Companies, Inc., 2000 11 © Adapted for use at JMU by Mohamed Aboutabl, 2003
A program with two fork functions
12
©The McGraw-Hill Companies, Inc., 2000 12 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Return Value of fork()
13
©The McGraw-Hill Companies, Inc., 2000 13 © Adapted for use at JMU by Mohamed Aboutabl, 2003
A program that prints the processIDs of the parent and the
child
14
©The McGraw-Hill Companies, Inc., 2000 14 © Adapted for use at JMU by Mohamed Aboutabl, 2003
Example of a server program with parent and child processes
15
©The McGraw-Hill Companies, Inc., 2000 15 © Adapted for use at JMU by Mohamed Aboutabl, 2003