Client-Server Applications
description
Transcript of Client-Server Applications
![Page 1: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/1.jpg)
Client-Server Applications
![Page 2: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/2.jpg)
Indirect Top Level InteractionApplication Application
Application Application
Application Application
![Page 3: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/3.jpg)
Client asks server to connect
ApplicationClient
ApplicationServer
Socket provides a STREAM based interaction
Connect request Connect request
![Page 4: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/4.jpg)
Server accepts
ApplicationClient
ApplicationServer
Connect accepted Connect accepted
![Page 5: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/5.jpg)
Client asks for a specific service
ApplicationClient
ApplicationServer
Service Request Service Request
![Page 6: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/6.jpg)
Server answers
ApplicationClient
ApplicationServer
Service Response Service Response
![Page 7: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/7.jpg)
Client disconnects
ApplicationClient
ApplicationServer
Disconnect Disconnect
![Page 8: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/8.jpg)
Server acknowledges… disconnected
ApplicationClient
ApplicationServer
Disconnect Acknowledged Disconnect Acknowledged
![Page 9: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/9.jpg)
Most interactions
• Connection request
• Service interaction
• Disconnect
• Give an illusion of looking like a single program when running effectively– Network/server delay is frequently obvious
![Page 10: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/10.jpg)
Common CLIENT-SERVERs
• FTP for transferring files from one machine to another (even if no account at both machines).
• TELNET/SSH for providing remote command-line (shell) access when you have an account on both machines. TELNET also will provide other functionality as we will see later.
• MAIL(smtp/pop/imap) transfer agents
• WWW(http) (WorldWideWeb) servers/browsers
![Page 11: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/11.jpg)
How do clients and serversidentify each other?
Client Server
Each end has 1. IP address2. port
![Page 12: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/12.jpg)
Ftp Exampleserver at 137.155.2.10
Client Server
Each end has 1. IP address2. port
1. 137.155.2.102. Port 211. 137.155.2.23
2. Port 12345
Servers run at a well-known portClient use a
randomlyassigned port
![Page 13: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/13.jpg)
Addresses
• IP -> unique to machine (actually to the interface/network card)– Only gets the message to the right machine
• Port– Service uses a standard port for connection
– Clients are randomly allocated
– A port is unique to a connection.
– Must identify a connection for a specific application.
– Makes sure the correct application receives the data
![Page 14: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/14.jpg)
FTP
![Page 15: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/15.jpg)
FTP
• A program for copying files from one machine to another
• Lets you do a FEW unix-type commands in the command-line version
CLIENT SERVER
connect
request login
login
request file
send file
logoff
General Exchange of Messages
FTP
![Page 16: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/16.jpg)
Sample client interaction w/ftp{dgame@cambria} ftp ftp.pcs.cnu.eduConnected to ftp.pcs.cnu.edu.220 america3 FTP server (UNIX(r) System V Release 4.0) ready.Name (ftp.pcs.cnu.edu:dgame): anonymous331 Guest login ok, send ident as password.Password: (your id)230 Guest login ok, access restrictions apply.ftp> cd pub/dgame/335250 CWD command successful.ftp> binary200 Type set to I.ftp> mget *mget AaronsFavCar.bmp? y200 PORT command successful.150 Binary data connection for AaronsFavCar.bmp (137.155.2.17,33136) (177562 bytes).226 Binary Transfer complete.local: AaronsFavCar.bmp remote: AaronsFavCar.bmp32768 bytes received in 0.017 seconds (1880.25 Kbytes/s)ftp> bye221 Goodbye.{dgame@cambria}
Client to Server Server to Client
Connect request
Service interaction
Disconnect
![Page 17: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/17.jpg)
USER Commands to use(not CLIENT)
• Not like a shell, but a
few of the commands
– cd
– close
– pwd
– lcd (change on the client side!)
– binary
– get
– put
– mget
– prompt
![Page 18: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/18.jpg)
USER commands
Client
Server
USER
![Page 19: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/19.jpg)
• Exchanges that actually go into the socket
• Not what the user enters
• This is the protocol.
Table 8.3 CLIENT commands
Client
Server
USER
ftp ftp.pcs.cnu.edu (1)
SYN (2) SYN+ACK (3)
ACK (4) 220 FTP server ready (5)
From Fig 8.16Session Connection
![Page 20: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/20.jpg)
Figure 8.16user enters username
Client
Server
USER
anonymous (1)
USER anonymous(2) 331 password required for anonymous(3)
USER anonymous(2)331 password required for anonymous(3)
![Page 21: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/21.jpg)
Figure 8.16user enters password
Client
Server
USER
PASS [email protected] (2)220 user anonymouslogged in(3)
![Page 22: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/22.jpg)
System OS.. No user inputClients and Servers interact on their own
Client
Server
USER
SYST(1) 215 Unix System V Release 4.0 (2)
Unix System V Release 4.0 (3)
In the previous example this exchange is done prior to the login, not after.
![Page 23: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/23.jpg)
Telnet
![Page 24: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/24.jpg)
Terminal - little local intelligence
TerminalNO local processing per se.Only a conduit to the Mainframe.
Keyboard
Here the PC has the program instead of the mainframe! In previously graphic, terminal is a relay.
Mainframe
Application
Keyboard
(Display and) xmit
PC
Application
Display
Display
![Page 25: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/25.jpg)
Remote terminal
•Run program remotely•Like a long cable to a keyboard at your house•Hyperterminal on Windows 95/98•Typically requires a modem•Only run command shell, not windows apps.
•What if you want a terminal access through the internet?•Telnet is your answer
![Page 26: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/26.jpg)
Telnet example
telnet [email protected] 5.6
login: dgamePassword:(….)Last login: Tue Jan 25 19:07:04 from cx81733-c.nwptn1You have new mail.{dgame@cambria:~ } pwd/home/faculty1/dgame{dgame@cambria:~ }exit{dgame@cambria:~ }logout(back on the original machine)
![Page 27: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/27.jpg)
How is telnet organized?
Computer to Use
Telnet Server
Computer now using
Telnet Client Internet
Keyboard
Terminal
Display and xmit
DisplayMainframe
Unix Shell
Unix Shell
![Page 28: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/28.jpg)
smtp/imap/pop
![Page 29: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/29.jpg)
SMTP
SERVERmail.pcs.cnu.edu
SERVERmail.uva.edu
pineWhatever client
the user chooses
POP or IMAP POP or IMAP
SMTP
Here a local server and remote server in addition to a remote and local client. For SMTP, the servers also functionas clients depending on which “server” makes the request.
![Page 30: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/30.jpg)
WWW/http
![Page 31: Client-Server Applications](https://reader035.fdocuments.us/reader035/viewer/2022081504/56814702550346895db43d94/html5/thumbnails/31.jpg)
How to Program
Sockets