The Client Server Model and Software Design Prof. Chuan-Ming Liu - - PowerPoint PPT Presentation

the client server model and software design
SMART_READER_LITE
LIVE PREVIEW

The Client Server Model and Software Design Prof. Chuan-Ming Liu - - PowerPoint PPT Presentation

Mobile Computing & Software Engineering Lab The Client Server Model and Software Design Prof. Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology Taipei, TAIWAN MCSE Lab, NTUT, TAIWAN 1


slide-1
SLIDE 1

MCSE Lab, NTUT, TAIWAN 1

Mobile Computing & Software Engineering Lab

The Client Server Model and Software Design

  • Prof. Chuan-Ming Liu

Computer Science and Information Engineering National Taipei University of Technology Taipei, TAIWAN

slide-2
SLIDE 2

NTUT, TAIWAN 2

Mobile Computing & Software Engineering Lab

Introduction

Short review for OSI model Peer-to-peer communication

Client-server paradigm

slide-3
SLIDE 3

NTUT, TAIWAN 3

Mobile Computing & Software Engineering Lab

Layering

Divide a task into pieces and then solve each piece independently (or nearly so). Establishing a well-defined interface between layers makes porting easier. Major Advantages:

♦Code Reuse ♦Extensibility

slide-4
SLIDE 4

NTUT, TAIWAN 4

Mobile Computing & Software Engineering Lab

Layering Example: Federal Express

Letter in envelope, address on outside FedX guy adds addressing information, barcode. Local office drives to airport and delivers to hub. Sent via airplane to nearest city. Delivered to right office Delivered to right person

slide-5
SLIDE 5

NTUT, TAIWAN 5

Mobile Computing & Software Engineering Lab

FedX Layers

Letter Addressed Envelope Letter Addressed Envelope

slide-6
SLIDE 6

NTUT, TAIWAN 6

Mobile Computing & Software Engineering Lab

Layered Software Systems

Network software Operating systems Windowing systems

slide-7
SLIDE 7

NTUT, TAIWAN 7

Mobile Computing & Software Engineering Lab

Unix is a Layered System

Applications Libraries System Calls Kernel

slide-8
SLIDE 8

NTUT, TAIWAN 8

Mobile Computing & Software Engineering Lab

OSI Reference Model

The International Standards Organization (ISO) proposal for the standardization of the various protocols used in computer networks (specifically those networks used to connect open systems) is called the Open Systems Interconnection Reference Model (1984), or simply the OSI model.

slide-9
SLIDE 9

NTUT, TAIWAN 9

Mobile Computing & Software Engineering Lab

OSI Model

Although the OSI model is a just a model (not a specification), it is generally regarded as the most complete model (as well it should be - nearly all of the popular network protocol suites in use today were developed before the OSI model was defined).

slide-10
SLIDE 10

NTUT, TAIWAN 10

Mobile Computing & Software Engineering Lab

OSI <-> Network Software

Although this course is about network programming (and not about networking in general), an understanding of a complete network model is essential.

slide-11
SLIDE 11

NTUT, TAIWAN 11

Mobile Computing & Software Engineering Lab

OSI 7 Layer Model:

7 Application 6 Presentation 5 Session 4 Transport 3 Network 2 Data-Link 1 Physical

High level protocols Low level protocols

slide-12
SLIDE 12

NTUT, TAIWAN 12

Mobile Computing & Software Engineering Lab

Simplified Network Model

Process Transport Network Data Link Process Transport Network Data Link Peer-to-peer Protocols Interface Protocols

slide-13
SLIDE 13

NTUT, TAIWAN 13

Mobile Computing & Software Engineering Lab

What’s a Protocol?

An agreed upon convention for communication.

both endpoints need to understand the protocol.

Protocols must be formally defined and unambiguous! We will study lots of existing protocols and perhaps develop a few of our own.

slide-14
SLIDE 14

NTUT, TAIWAN 14

Mobile Computing & Software Engineering Lab

Interface and Peer-to-peer Protocols

Interface protocols describe the communication between layers on the same endpoint. Peer-to-peer protocols describe communication between peers at the same layer.

Process Transport Network Data Link Process Transport Network Data Link Interface Protocols Peer-to-peer Protocols

slide-15
SLIDE 15

NTUT, TAIWAN 15

Mobile Computing & Software Engineering Lab

Physical Layer

Coordinates the functions required to transmit a bit stream over a physical medium Concerns

Physical characteristics of interfaces and medium Representation of bits Data rate (Transmission rate): bits/sec Synchronization of bits

slide-16
SLIDE 16

NTUT, TAIWAN 16

Mobile Computing & Software Engineering Lab

Physical Layer

Line configuration

Point-to-point Multipoint

Physical topology mesh, star, ring, or bus. Transmission mode simplex, half-duplex, or full-duplex

slide-17
SLIDE 17

NTUT, TAIWAN 17

Mobile Computing & Software Engineering Lab

Physical Layer

slide-18
SLIDE 18

NTUT, TAIWAN 18

Mobile Computing & Software Engineering Lab

Data Link Layer

Transforms the physical layer to a reliable link Makes the physical layer appear error free to upper layer Responsible for

Framing frames Physical addressing (physical address)

Header defines the sender and/or receiver Receiver is the device connected to the next

slide-19
SLIDE 19

NTUT, TAIWAN 19

Mobile Computing & Software Engineering Lab

Data Link Layer

Flow control Error control Access control

Multi-home: computer having two or more NICs

slide-20
SLIDE 20

NTUT, TAIWAN 20

Mobile Computing & Software Engineering Lab

Data Link Layer

slide-21
SLIDE 21

NTUT, TAIWAN 21

Mobile Computing & Software Engineering Lab

Node-to-node Delivery

slide-22
SLIDE 22

NTUT, TAIWAN 22

Mobile Computing & Software Engineering Lab

Network Layer

Responsible for the source-to-destination delivery of a packet Responsibilities:

Logical addressing (IP address) Routing

slide-23
SLIDE 23

NTUT, TAIWAN 23

Mobile Computing & Software Engineering Lab

Network Layer

slide-24
SLIDE 24

NTUT, TAIWAN 24

Mobile Computing & Software Engineering Lab

End-to-end Delivery

slide-25
SLIDE 25

NTUT, TAIWAN 25

Mobile Computing & Software Engineering Lab

Transport Layer

Source-to-destination (end-to-end) delivery of the entire message Functions include:

Service-point addressing (port) Segmentation and reassembly Connection control connectionless v.s. connection-oriented Flow control Error control

slide-26
SLIDE 26

NTUT, TAIWAN 26

Mobile Computing & Software Engineering Lab

Transport Layer

slide-27
SLIDE 27

NTUT, TAIWAN 27

Mobile Computing & Software Engineering Lab

Reliable end-to-end delivery of a message

slide-28
SLIDE 28

NTUT, TAIWAN 28

Mobile Computing & Software Engineering Lab

Session Layer

Network dialog controller

establishes, maintains, and synchronizes the interaction between communicating systems

Functions include:

Dialog control Synchronization (checkpoint)

slide-29
SLIDE 29

NTUT, TAIWAN 29

Mobile Computing & Software Engineering Lab

Session Layer

slide-30
SLIDE 30

NTUT, TAIWAN 30

Mobile Computing & Software Engineering Lab

Presentation Layer

Concerned with the syntax an semantics

  • f the information exchanged between

two systems Responsibilities include

Translation Encryption Compression

slide-31
SLIDE 31

NTUT, TAIWAN 31

Mobile Computing & Software Engineering Lab

Presentation Layer

slide-32
SLIDE 32

NTUT, TAIWAN 32

Mobile Computing & Software Engineering Lab

Application Layer

Interface for users to access the network Services include

Network virtual terminal File transfer, access, and management (FTAM) Mail services Directory services

slide-33
SLIDE 33

NTUT, TAIWAN 33

Mobile Computing & Software Engineering Lab

Application Layer

slide-34
SLIDE 34

NTUT, TAIWAN 34

Mobile Computing & Software Engineering Lab

Summary of Layers

slide-35
SLIDE 35

NTUT, TAIWAN 35

Mobile Computing & Software Engineering Lab

TCP/IP Protocol Suite

Physical Layer Data link Layer Network Layer Transport Layer Application Layer No specific protocol defined in physical and data link layers in TCP/IP

Correspond to OSI model Last three layers in OSI

slide-36
SLIDE 36

NTUT, TAIWAN 36

Mobile Computing & Software Engineering Lab

TCP/IP and OSI model

slide-37
SLIDE 37

NTUT, TAIWAN 37

Mobile Computing & Software Engineering Lab

Network Layer

Internetwork layer Support

IP: Internetworking Protocol ARP: Address Resolution Protocol RARP: Reverse Address Resolution Protocol ICMP: Internet Control Message Protocol IGMP: Internet Group Message protocol

slide-38
SLIDE 38

NTUT, TAIWAN 38

Mobile Computing & Software Engineering Lab

Internetworking Protocol (IP)

Transmission mechanism Datagram: data unit to be sent in IP Unreliable and connectionless Best-effort delivery service Host-to-host protocol

slide-39
SLIDE 39

NTUT, TAIWAN 39

Mobile Computing & Software Engineering Lab

Transport Layer

TCP and UDP: delivery of a message from a process to another process

User Datagram Protocol (UDP) Transmission Control Protocol (TCP)

slide-40
SLIDE 40

NTUT, TAIWAN 40

Mobile Computing & Software Engineering Lab

TCP/IP

Provides basic mechanisms used to transfer data Allows a programmer to establish communication between applications Provides peer-to-peer communication One organizational method to use TCP/IP is the client-server paradigm

slide-41
SLIDE 41

NTUT, TAIWAN 41

Mobile Computing & Software Engineering Lab

Motivation

Scenario: A user tries to start two programs on separate machines and have them communicate. Program 1 starts Send message to its peer

Not running; Refuse No response; exit

Program 2 starts

No connection can be set up

slide-42
SLIDE 42

NTUT, TAIWAN 42

Mobile Computing & Software Engineering Lab

Client-Server Model

One side in any pair of communicating application must start execution and wait for the other side to contact it. Since the client-server model places responsibility for rendezvous problem on application, TCP/IP does not need to provide mechanisms that automatically create a running program when a message

  • arrives. Instead, a program must be waiting

to accept communication before any request arrive.

slide-43
SLIDE 43

NTUT, TAIWAN 43

Mobile Computing & Software Engineering Lab

Terminology and Concepts

Clients and Servers Privilege and Complexity Standard v.s. Nonstandard Client Software Parameterization of Clients Connectionless v.s. Connection-oriented Servers Stateless v.s. Stateful Servers Identifying a Client

slide-44
SLIDE 44

NTUT, TAIWAN 44

Mobile Computing & Software Engineering Lab

Clients and Servers

Client * An application that initiates peer-to- peer communication, e.g. web browser * Easier to build than servers * System privileges usually unnecessary Server Program that waits for incoming communication requests from a client

slide-45
SLIDE 45

NTUT, TAIWAN 45

Mobile Computing & Software Engineering Lab

Privilege and Complexity

Server software often needs to access to objects that OS protects Server can not rely on the usual OS check since its privilege status allow to access any file Security issues:

Authentication Authorization Data Security Privacy Protection

slide-46
SLIDE 46

NTUT, TAIWAN 46

Mobile Computing & Software Engineering Lab

Privilege and Complexity

The combination of special privileges and concurrent operation usually makes servers more difficult to design and implementation

slide-47
SLIDE 47

NTUT, TAIWAN 47

Mobile Computing & Software Engineering Lab

Standard v.s. Nonstandard Client Software

Standard application services

Defined by TCP/IP Assigned well-known, universally recognized protocol port

Non-standard application services

All other services which is not standard Or, locally-defined application services

slide-48
SLIDE 48

NTUT, TAIWAN 48

Mobile Computing & Software Engineering Lab

Standard v.s. Nonstandard Client Software

Be aware of the standard when outside the local environment Standard application service examples

Remote login, TELNET protocol E-mail client, SMTP or POP protocol File transfer client, FTP protocol Web browser, HTTP protocol

slide-49
SLIDE 49

NTUT, TAIWAN 49

Mobile Computing & Software Engineering Lab

Standard v.s. Nonstandard Client Software

Non-standard application service examples

Music or video transfer Voice communication Distributed database access

slide-50
SLIDE 50

NTUT, TAIWAN 50

Mobile Computing & Software Engineering Lab

Parameterization of Clients

Generality for client software e.g. TELNET protocol using port number Fully parameterized client application allows more input parameters

slide-51
SLIDE 51

NTUT, TAIWAN 51

Mobile Computing & Software Engineering Lab

Parameterization of Clients

When designing client application, include parameters that allow the user to fully specify the destination machine and port number.

slide-52
SLIDE 52

NTUT, TAIWAN 52

Mobile Computing & Software Engineering Lab

Connectionless v.s. Connection-Oriented Servers

TCP/IP provides two types of interaction between client and server:

Connectionless style Connection-oriented style

The distinction is critical TCP UDP

slide-53
SLIDE 53

NTUT, TAIWAN 53

Mobile Computing & Software Engineering Lab

Connection-Oriented Servers

TCP: * full reliability * verifying the data arrives * automatically retransmits segments * checksum over the data * data arriving in order * no duplicated packets * control the flow * reporting the underlying network problem to sender

slide-54
SLIDE 54

NTUT, TAIWAN 54

Mobile Computing & Software Engineering Lab

Connectionless Servers

UDP * no guarantees about reliable delivery * software contains code to detect and correct errors occurred by transmission * work well when the underlying network running well * aware of testing when using UDP

slide-55
SLIDE 55

NTUT, TAIWAN 55

Mobile Computing & Software Engineering Lab

Connectionless v.s. Connection-Oriented Servers

TCP is preferable to UDP

TCP simplifies programming TCP relieves the programmers of responsibility for detecting and correcting errors Adding reliability to UDP is a nontrivial work

slide-56
SLIDE 56

NTUT, TAIWAN 56

Mobile Computing & Software Engineering Lab

Connectionless v.s. Connection-Oriented Servers

Application programs use UDP only if

Application protocol specifies the UDP must be used Application protocol relies on hardware broadcast or multicast for delivery Overhead for reliability is unnecessary

slide-57
SLIDE 57

NTUT, TAIWAN 57

Mobile Computing & Software Engineering Lab

Stateless v.s. Stateful Servers

State information A server maintains about the status of

  • ngoing interaction with clients

Servers that do not keep any state information are called stateless servers;

  • therwise, called stateful servers.
slide-58
SLIDE 58

NTUT, TAIWAN 58

Mobile Computing & Software Engineering Lab

Stateless v.s. Stateful Servers

Keeping a small amount of information in a server can reduce the size of messages that the client and server exchange and allow the server to response quickly The point for statefulness is efficiency The motivation for statelessness lies in protocol reliability

slide-59
SLIDE 59

NTUT, TAIWAN 59

Mobile Computing & Software Engineering Lab

Stateless File Server Example

disk File server client

Waits for client to access stores or extracts data from the server message

Operation (read or write) Name of the file Position in the file Number of bytes to transfer Present only in write operation

  • p

name pos size data Description Item

slide-60
SLIDE 60

NTUT, TAIWAN 60

Mobile Computing & Software Engineering Lab

Stateful File Server Example

disk File server client

Waits for client to access stores or extracts data from the server reads

Operation (read or write) Name of the file Position in the file Number of bytes to transfer Present only in write operation

  • p

name pos size data Description Item

slide-61
SLIDE 61

NTUT, TAIWAN 61

Mobile Computing & Software Engineering Lab

Stateful File Server Example

read read write read 456 38 125 test.program.c tcp.book.text dept.budget.txt teris.txt 1 2 3 4 Last Operation Current Position File Name Client

State information table

slide-62
SLIDE 62

NTUT, TAIWAN 62

Mobile Computing & Software Engineering Lab

Identifying a Client

Stateful servers use two general approaches to identify clients

Endpoints Handles

Endpoint identification

Operate automatically Relies on transport protocol, not application protocol Endpoint information may change

slide-63
SLIDE 63

NTUT, TAIWAN 63

Mobile Computing & Software Engineering Lab

Identifying a Client

server Transport protocol IP address and port number using the endpoint information to look up the state table

slide-64
SLIDE 64

NTUT, TAIWAN 64

Mobile Computing & Software Engineering Lab

Identifying a Client

Handles

remains constant across multiple transport connections A small integer Independent of the underlying transport protocol

Change of transport connection does not invalidate handles Visibility to the application – drawback

slide-65
SLIDE 65

NTUT, TAIWAN 65

Mobile Computing & Software Engineering Lab

Identifying a Client

Back to stateful server

Can not retain state forever and application protocol requires termination Using endpoint identification can be confused by a crash

slide-66
SLIDE 66

NTUT, TAIWAN 66

Mobile Computing & Software Engineering Lab

Identifying a Client

The point of state is efficient

Reducing the amount of data transferred Intuitive design Difficulty

Maintain the correctness when delay, duplication allowed State information may be incorrect when computer restarts

slide-67
SLIDE 67

NTUT, TAIWAN 67

Mobile Computing & Software Engineering Lab

Identifying a Client

In general, in a real internet, where machines crash and reboot, and messages can be lost, delayed, duplicated, or delivered out of order, stateful designs lead to complex application protocols that are difficult to design , understand, and implement correctly.

slide-68
SLIDE 68

NTUT, TAIWAN 68

Mobile Computing & Software Engineering Lab

Statelessness is a Protocol Issues

Statelessness or not centers on the application protocol more than implementation The issue of statelessness focuses on whether the application protocol assumes the responsibility for reliable delivery Idempotent – design issue for statelessness operation always has the same result

slide-69
SLIDE 69

NTUT, TAIWAN 69

Mobile Computing & Software Engineering Lab

Servers as Clients

Programs do not fit exactly into the definition of client or server Avoid circular dependencies among servers

Internet

client time server file server