Exploration1_4.0_Chapter-03 Application Layer Functionality and Protocols
1 Chapter 26-27 Client-Server Interaction. 2 Functionality Transport layer and layers below Basic...
-
Upload
egbert-lee -
Category
Documents
-
view
212 -
download
0
Transcript of 1 Chapter 26-27 Client-Server Interaction. 2 Functionality Transport layer and layers below Basic...
1
Chapter 26-27
Client-Server Interaction
2
FunctionalityFunctionality
Transport layer and layers belowBasic communicationReliability
Application layerAbstractions
FilesServicesDatabases
Names
3
Dichotomy of DutiesDichotomy of Duties
NetworkTransfers bitsOperates at application’s request
Applications determineWhat to sendWhen to sendWhere to sendMeaning of bits
4
Important PointImportant Point
Although an internet system provides a basic communication service, the protocol software cannot initiate contact with, or accept contact from, a remote computer. Instead, two application programs must participate in any communication: one application initiates communication and the other accepts it.
5
How Two Application Programs Make Contact
How Two Application Programs Make Contact
One applicationBegins execution firstWaits passively at prearranged location
Another applicationBegins execution laterActively contacts first program
Called client-server interaction
6
Client-Server ParadigmClient-Server Paradigm
Used by all network applicationsPassive program called a serverActive program called a client
7
Internet CommunicationInternet Communication
All network applications use a form of communication known as the client-server paradigm. A server application waits passively for contact, while a client application initiates communication actively.
If both parties are equal, you may have a peer-to-peer solution
8
Characteristics of a ClientCharacteristics of a Client
Arbitrary application programBecomes client temporarilyCan also perform other computationsInvoked directly by userRuns locally on user’s computerActively initiates contact with a serverContacts one server at a time
9
Characteristics of a ServerCharacteristics of a Server
Special-purpose, privileged programDedicated to providing one serviceCan handle multiple remote clients simultaneouslyInvoked automatically when system bootsExecutes foreverNeeds powerful computer and operating systemWaits passively for client contactAccepts requests from arbitrary clients
10
TerminologyTerminology
ServerAn executing program that accepts contact over
the networkServer-class computer
Hardware sufficient to execute a serverInformally
Term server often applied to computer
11
Direction of Data FlowDirection of Data Flow
Data can flowFrom client to server onlyFrom server to client onlyIn both directions
Application protocol determines flowTypical scenario
Client sends request(s)Sever sends response(s)
12
Key IdeaKey Idea
Although the client initiates contact, information can flow in either or both directions between a client and server. Many services arrange for the client to send one or more requests and the server to return one response for each request.
13
Clients, Servers, and Other Protocols
Clients, Servers, and Other Protocols
Clients and servers are application programs
14
Server CPU UseServer CPU Use
FactsServer operates like other applications
Uses CPU to execute instructionsPerforms I/O operations
Waiting for data to arrive over a network does not require CPU time
ConsequenceServer program only uses CPU when servicing a
request
15
Multiple ServicesMultiple Services
Can have multiple servers on single computer
Servers only use processor when handling a request
Powerful hardware required to handle many services simultaneously
16
Illustration of Multiple Servers
Illustration of Multiple Servers
Each server offers one serviceOne server can handle multiple clients
17
Identifying a ServiceIdentifying a Service
Protocol port number usedEach service given unique port number, PServer
Informs OS it is using port PWaits for requests to arrive
ClientForms requestSend request to port P on server computer
18
The Point About PortsThe Point About Ports
Transport protocols assign each service a unique port identifier. A server must specify the identifier when it begins execution. A client must specify the identifier when it requests transport protocol software to contact a server. Protocol software on the server computer uses the identifier to direct an incoming request to the correct server.
19
In TheoryIn Theory
Port numbers are merely integersAny server could use any port number
20
In PracticeIn PracticeProtocol port numbers used as service identifiersNeed uniform numbering
To allow arbitrary client to contact server on arbitrary machine
To avoid inventing “directory assistance” mechanismPort numbers
Uniform throughout InternetSet by standards bodies (IANA – Internet Assigned
Numers Authority)
21
Assigned port numbersAssigned port numbersThe port numbers are divided into three ranges:
The Well Known Ports, 0 - 1023. The Registered Ports, 1024 - 49151 The Dynamic and/or Private Ports, 49152 – 65535
Numbers primarily assigned for TCP. UDP for most part uses the same numbers
http://www.iana.org/assignments/port-numbers
22
TerminologyTerminology
Sequential programTypical of most programsSingle thread of control
Concurrent programMultiple threads of controlExecution proceeds “in parallel”More difficult to create
23
Servers and ConcurrencyServers and Concurrency
Sequential serverAlso called iterativeHandles one request at a time
Concurrent serverCan handle multiple requests at a timeNo waiting
24
Delay in ServersDelay in Servers
Concurrent serverServer creates new thread of control to handle each
requestClient only waits for its request to be processed
Sequential serverClient waits for all previous requests to be processed as
well as for its request to be processedUnacceptable to user if long request blocks short
requests
25
Concurrency in ServersConcurrency in Servers
Concurrent execution is fundamental to servers because concurrency permits multiple clients to obtain a given service without having to wait for the server to finish previous requests. In a concurrent server, the main server thread creates a new service thread to handle each client.
26
Protocol Ports and Concurrent ServersProtocol Ports and Concurrent Servers
Apparent problemOne port number assigned to each serviceConcurrent server has multiple copies (threads)
runningClient and server may interactMessages sent to server’s port must be delivered
to correct copy
27
Protocol Ports and Concurrent Servers
(continued)
Protocol Ports and Concurrent Servers
(continued)Solution to problem: use information about
client as well as server to deliver incoming packets
TCP uses four items to identify connectionServer’s IP addressServer’s protocol port numberClient’s IP addressClient’s protocol port number
28
Demultiplexing in a Concurrent ServerDemultiplexing in a Concurrent Server
Transport protocols assign an identifier to each client as well as to each service. Protocol software on the server’s machine uses the combination of client and server identifiers to choose the correct copy of a concurrent server.
29
Variations on a ThemeVariations on a Theme
A server can useConnectionless transport (UDP)Connection-oriented transport (TCP)Both for a single service
A single server can offer multiple servicesOften used for “trivial” servicesServer uses multiple port numbers
simultaneously
30
Variations on a Theme (cont)
Variations on a Theme (cont)
A server canMaintain interaction with a client for days or
hoursSend a short response and terminate interactionPerform I/O on the local computerBecome a client for another service (potential
cycle problem)
31
Example of CircularityExample of Circularity
Time serverReturns time of day
File serverAllows client to read or write a fileCalls time server when generating time stamp for
fileSuppose programmer modifies time server to
log requests to a file
32
Interacting with Protocol Software
Interacting with Protocol Software
Client or server uses transport protocolsProtocol software inside OSApplications outside OSMechanism needed to bridge the two
Called Application Program Interface (API)
33
Application Program Interface
Application Program Interface
Part of operating systemPermits application to use protocolsDefines
Operations allowedArguments for each operation
34
Socket APISocket API
Originally designedFor BSD UNIXTo use with TCP/IP protocols
NowIndustry standardAvailable on many operating systems
35
Sockets and Socket Libraries
Sockets and Socket Libraries
A socket library can provide applications with a socket API on a computer system that does not provide native sockets. When an application calls one of the socket procedures, control passes to a library routine that makes one or more calls to the underlying operating system to implement the socket function.
36
SocketSocket
OS abstraction (not hardware)Created dynamicallyPersists only while application runsReferenced by a descriptor
37
DescriptorDescriptor
Small integerOne per active socketUsed in all operations on socketGenerated by OS when socket createdOnly meaningful to application that owns
socketIn UNIX, integrated with file descriptors