文件传输服务FTP(中山大学计算机网络实验资料)_第1页
文件传输服务FTP(中山大学计算机网络实验资料)_第2页
文件传输服务FTP(中山大学计算机网络实验资料)_第3页
文件传输服务FTP(中山大学计算机网络实验资料)_第4页
文件传输服务FTP(中山大学计算机网络实验资料)_第5页
已阅读5页,还剩56页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 FTP服务的工作过程服务的工作过程 TCP通信过程 TCP数据报格式 正常TCP通信过程: 建立连接 数据传输 断开连接TCP数据报格式TCP数据报格式 TCP标志位 ACK:确认标志 RST: 复位标志 URG:紧急标志 SYN:建立连接标志 PSH: 推标志 FIN: 结束标志TCP连接建立过程TCP数据传输过程TCP PacketEstablishedEstablishedSEQ=1001,ACK=751,dataLen=256Sending1Waiting1SEQ=751,ACK=1257OK1ACK1SEQ=751,ACK=1513OK2ACK2SEQ=1257,ACK=751,d

2、ataLen=256Sending2Waiting2TCP连接断开过程TCP PacketEstablishedEstablishedSEQ=1513,ACK=751,CTL=FIN|ACKFIN-WAIT-1CLOSE-WAITSEQ=751,ACK=1514,CTL=ACKFIN-WAIT-2CLOSE-WAITSEQ=751,ACK=1514,CTL=FIN|ACKTIME-WAITLAST-ACKSEQ=1514,ACK=752,CTL=ACKTIME-WAITCLOSEDCLOSED实验环境 位于同一局域网内的两台主机,IP分别为:4,19

3、 一个C/S模式的程序,实现简单的TCP数据发送与接收 Client运行在4 Server运行在19实验环境 Client发送两次数据,内容分别为123和456,然后发送0结束TCP连接。 程序截图如下。客户端发送数据客户端发送数据服务端接收到数据服务端接收到数据捕获数据包 在Client发送数据之前,在4主机(Client)上开启Ethereal。 在捕获前不进行过滤,直接捕获所有数据包。 当Client结束TCP连接之后,停止捕获数据包。 采用捕获后过滤的方法,过滤规则是tcp AND ip.addr=

4、19其中,19是Server主机。 过滤后,共得到11个数据包,见下页图。数据包详细分析 这11个数据包的含义如下: 13:三次握手,建立连接 45:第一次发送数据 67:第二次发送数据 811:断开连接 下面将对这11个数据包进行详细分析。1 CS SYNSEQ=X+0与与TCP报报文文格格式式相相对对应应2 SC SYN,ACKSEQ=Y+0ACK=X+13 CS ACKSEQ=X+1ACK=Y+1三次握手结束三次握手结束4 CS PSH,ACKSEQ=X+1, data length=256, next seq=257ACK=Y+1数据内容见下页图数据内容见下页图T

5、CP segment data(256 bytes)这是第一次这是第一次发送的数据发送的数据1235 SC ACKSEQ=Y+1ACK=X+257第一次传输数据结束第一次传输数据结束6 CS PSH,ACKSEQ=X+257, data length=256, next seq=513ACK=Y+1数据内容见下页图数据内容见下页图TCP segment data(256 bytes)这是第二次这是第二次发送的数据发送的数据4567 SC ACKSEQ=Y+1ACK=X+513第二次传输数据结束第二次传输数据结束8 CS FIN,ACKSEQ=X+513ACK=Y+19 SC ACKSEQ=Y+

6、1ACK=X+51410 SC FIN,ACKSEQ=Y+1ACK=X+51411 CS ACKSEQ=X+514ACK=Y+2TCP连接已经断开连接已经断开 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restricti

7、ons apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kb

8、ytes/s).14 ftp quit15 221 Goodbye.01 用户要用 FTP 和远地主机建立连接。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc

9、09 250 CWD command successful.10 ftp get rfc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 2

10、21 Goodbye.02 本地 FTP 发出的连接成功信息。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command succes

11、sful.10 ftp get rfc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.03 从远地服务器返回的信息

12、,220 表示“服务就绪”。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get r

13、fc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.04 本地 FTP 提示用户键入名字。用户键入的名字表示“匿名

14、”。用户只需键入 anonymous 即可。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 f

15、tp get rfc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.05 数字 331 表示“用户名正确”,需要口

16、令。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.txt n

17、icinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.06 本地 FTP 提示用户键入口令。用户这时可键入guest 作为匿名的口令,也可以

18、键入自己的电子邮件地址,即名为 xyz 的主机上的 abc。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command success

19、ful.10 ftp get rfc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.07 数字 230 表示用户已

20、经注册完毕。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.t

21、xt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.“ftp”是 FTP 的提示信息。用户键入的是将目录改变为包含 RFC 文件的

22、目录。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.txt

23、nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.09 字符 CWD 是 FTP 的标准命令,代表 Change Working Di

24、rectory。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261

25、.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.10 用户要求将名为 rfc1261.txt 的文件复制到本地主机上,并改

26、名为 nicinfo。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1

27、261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.11 字符 PORT 是 FTP 的标准命令,表示要建立数据连接。2

28、00 表示“命令正确”。 01 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc

29、1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.12 数字 150 表示“文件状态正确, 即将建立数据连接”。 0

30、1 ftp 02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.txt nicin

31、fo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.13 数字 226 是“释放数据连接”。现在一个新的本地文件已产生。 01 ftp nic.d

32、02 connected to 03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.txt nicinfo11 200 PO

33、RT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 bytes).13 226 ASCII Transfer complete. local: nicinfo remote: rfc1261.txt 4488 bytes received in 15 seconds (0.3 Kbytes/s).14 ftp quit15 221 Goodbye.14 用户键入退出命令。 01 ftp 02 connected to

34、03 220 nic FTP server (Sunos 4.1)ready.04 Name: anonymous05 331 Guest login ok, send ident as password.06 Password: 07 230 Guest login ok, access restrictions apply.08 ftp cd rfc09 250 CWD command successful.10 ftp get rfc1261.txt nicinfo11 200 PORT command successful.12 150 ASCII data connection for rfc1261.txt (7,1401) (4318 b

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论