02Sockets高级计算机网络.ppt

上传人:bao****ty 文档编号:144340407 上传时间:2020-09-07 格式:PPT 页数:38 大小:638.50KB
返回 下载 相关 举报
02Sockets高级计算机网络.ppt_第1页
第1页 / 共38页
02Sockets高级计算机网络.ppt_第2页
第2页 / 共38页
02Sockets高级计算机网络.ppt_第3页
第3页 / 共38页
02Sockets高级计算机网络.ppt_第4页
第4页 / 共38页
02Sockets高级计算机网络.ppt_第5页
第5页 / 共38页
点击查看更多>>
资源描述

《02Sockets高级计算机网络.ppt》由会员分享,可在线阅读,更多相关《02Sockets高级计算机网络.ppt(38页珍藏版)》请在金锄头文库上搜索。

1、1,Networked Applications: Sockets,COS 461: Computer Networks Jennifer Rexford,2,Goals of Todays Lecture,Client-server paradigm End systems Clients and servers Sockets Socket abstraction Socket programming in UNIX File-Transfer Protocol (FTP) Uploading and downloading files Separate control and data

2、connections,3,End System: Computer on the Net,Internet,Also known as a “host”,4,Clients and Servers,Client program Running on end host Requests service E.g., Web browser,Server program Running on end host Provides service E.g., Web server,GET /index.html,“Site under construction”,5,Clients Are Not N

3、ecessarily Human,Example: Web crawler (or spider) Automated client program Tries to discover -) Software available online at http:/www.apache.org Mozilla Web browser http:/www.mozilla.org/developer/ Sendmail http:/www.sendmail.org/ BIND Domain Name System Client resolver and DNS server http:/www.isc

4、.org/index.pl?/sw/bind/ ,28,Advice for Assignment #1,Start early (even if March 1 seems far away) Familiarize yourself with the socket API Read the online references Read the manual pages (e.g., “man socket”) Feeling self-referential? Do “man man”! Write a simple socket program first E.g., simple ec

5、ho program E.g., simple FTP client that connects to server Learn about the File Transfer Protocol Assignment #1 Web page Request For Comments 959,29,File Transfer Protocol (FTP),Allows a user to copy files to/from remote hosts Client program connects to FTP server and provides a login id and passwor

6、d and allows the user to explore the directories and download and upload files with the server A predecessor of the Web (RFC 959 in 1985) Requires user to know the name of the server machine and have an account on the machine and find the directory where the files are stored and know whether the fil

7、e is text or binary and know what tool to run to render and edit the file That is, no URL, hypertext, and helper applications,30,FTP Protocol,Control connection (on server port 21) Client sends commands and receives responses Connection persists across multiple commands FTP commands Specification in

8、cludes more than 30 commands Each command ends with a carriage return and a line feed (“rn” in C) Server responds with a three-digit code and optional human-readable text (e.g., “226 transfer completed”) Try it at the UNIX prompt ftp ftp.cs.princeton.edu Id “anonymous” and password as your e-mail ad

9、dress,31,Example Commands,Authentication USER: specify the user name to log in as PASS: specify the users password Exploring the files LIST: list the files for the given file specification CWD: change to the given directory Downloading and uploading files TYPE: set type to ASCII (A) or binary image

10、(I) RETR: retrieve the given file STOR: upload the given file Closing the connection QUIT: close the FTP connection,32,Server Response Codes,1xx: positive preliminary reply The action is being started but expect another reply before sending the next command. 2xx: positive completion reply The action

11、 succeeded and a new command can be sent. 3xx: positive intermediate reply The command was accepted but another command is now required. 4xx: transient negative completion reply The command failed and should be retried later. 5xx: permanent negative completion reply The command failed and should not

12、 be retried.,33,FTP Data Transfer,Separate data connection To send lists of files (LIST) To retrieve a file (RETR) To upload a file (STOR),control,data,34,Creating the Data Connection,Client acts like a server Creates a socket Client acquires an ephemeral port number Binds an address and port number

13、 Waits to hear from the FTP server,control,socket,35,Creating Data Connection (cont.),But, the server doesnt know the port number So, the client tells the server the port number Using the PORT command on the control connection,PORT ,36,Creating Data Connection (cont),Then, the server initiates the d

14、ata connection Connects to the socket on the client machine and the client accepts to complete the connection,socket,37,Why Out-of-Band Control?,Avoids need to mark the end of the data transfer Data transfer ends by closing of data connection Yet, the control connection stays up Aborting a data tran

15、sfer Can abort a transfer without killing the control connection which avoids requiring the user to log in again Done with an ABOR on the control connection Third-party file transfer between two hosts Data connection could go to a different hosts by sending a different client IP address to the serve

16、r E.g., user coordinates transfer between two servers,38,Conclusions,Client-server paradigm Model of communication between end hosts Client asks, and server answers Sockets Simple byte-stream and messages abstractions Common application programmable interface File-Transfer Protocol (FTP) Protocol for downloading and uploading files Separate control and data connections Next Monday: IP packet switching!,

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号