Download presentation
Presentation is loading. Please wait.
1
Client-Server Model and Sockets
King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department ICS 343 Fundamentals of Computer Networks Client-Server Model and Sockets These slides are based on: - Understanding Networked Applications, David Messerschmitt - Introduction to Sockets and TCP/IP Protocols, Leon Jololian and George Blank
2
Copyright 1999, University of California
Aug 26, 2012 Client-Server Model Client host Client host Server host
3
Client Server Model Client application program running on the local machine requests a service from another application program – server – running on the remote machine. Commonly server provides service to any client, not a particular client Generally, a client application program that requests a service should run only when it is needed. A server program providing service should run all the time, as it does not know when its services will be needed.
4
Client Server Model A client opens the communication channel using IP address of the remote host and the port address of the specific server program running on the host – Active open. Request-response may be repeated several times, the process is finite. The client closes the communication channel with an Active close.
5
Client Server Model A server program opens its door for incoming requests from clients but never initiates a service unless explicitly requested – Passive open. A server program is infinite – runs unless a problem occurs. Concurrency in client: two or more clients can run at the same time on a machine – current trend, alternatively: one client must start, run, and terminate before another client may start (iterative).
6
Client Server Model Concurrency in server: An iterative server can process only one request at a time whereas a concurrent server can process many requests at the same time – share its time. Connectionless iterative server: the ones that use UDP are iterative, server uses one single port, arriving packets wait in line, Connection oriented concurrent server: the ones that use TCP are normally concurrent,
7
Client–Server Computing
Process takes place on the server and on the client Servers Store and protect data Process requests from clients Clients Make requests Format data on the desktop
8
Copyright 1999, University of California
Aug 26, 2012 Example: Server Server Client Client client sends message to server Later, recipient’s client retrieves message from server Message is stored on POP server
9
Copyright 1999, University of California
Aug 26, 2012 Chat Server Server Client Client Chat server aggregates typing from all users and sends to all clients Other user’s clients display aggregated typing from chat server Chat clients send user’s typing to server
10
Client-Server Vs Peer-To-Peer
Copyright 1999, University of California Copyright 1999, University of California Aug 26, 2012 Aug 26, 2012 Client-Server Vs Peer-To-Peer “I want to collaborate with my colleague” “I want to access some information” Client Peer-to-peer Server Client/server 10
11
Client-Server Vs Peer-To-Peer
Copyright 1999, University of California Aug 26, 2012 Client-Server Vs Peer-To-Peer Client-server Asymmetric relationship Client predominately makes requests, server makes replies Peer-to-peer Symmetric relationship
12
Types of Servers Application Servers Audio/Video Servers Chat Servers
Fax Servers FTP Servers Groupware Servers IRC Servers List Servers Mail Servers News Servers Proxy Servers Telnet Servers Web Servers Z39.50 Servers
13
Socket Socket: is a construct that supports network input/output. An application creates a socket when it needs a connection to a network. It then establishes a connection to a remote application via the socket. Communication is achieved by reading data from the socket and writing data to it. Socket acts as an endpoint.
14
Socket
15
Socket A socket is defined in the OS as a structure.
Simplified socket structure with five fields: - Family: defines the protocol group (IPv4, IPv6, UNIX domain protocols) - Type: defines the exchange-type (stream, packet, raw) - Protocol: set to zero for TCP/ UDP - Local address: combination of local IP and application port address. - Remote address: combination of remote IP and application port address.
16
Socket Stream socket: to be used with connection oriented protocol (TCP) Datagram socket: to be used with connectionless protocol (UDP) Raw socket: some protocols (ICMP) directly use the service of IP. Raw sockets are used in these applications.
17
The end
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.