CS144Lab/writeups/lab7.md
2023-02-18 16:37:55 +00:00

7.2 KiB
Raw Blame History

Lab 7 Writeup

My name: Catfood

My SUNet ID: 998244353

I collaborated with: An orange cat

This lab took me about 1 hours to do.

Solo portion:

就,照着敲命令就好了。不过不知道为啥,好像有点慢而且有概率会失败,需要耐心一点。

Section 3

server run first

➜  build git:(master) ./apps/lab7 server cs144.keithw.org 3000
DEBUG: Network interface has Ethernet address 02:00:00:09:60:3c and IP address 172.16.0.1
DEBUG: Network interface has Ethernet address 02:00:00:0c:50:e4 and IP address 10.0.0.172
DEBUG: adding route 172.16.0.0/12 => (direct) on interface 0
DEBUG: adding route 10.0.0.0/8 => (direct) on interface 1
DEBUG: adding route 192.168.0.0/16 => 10.0.0.192 on interface 1
DEBUG: Network interface has Ethernet address 8a:0e:de:4e:97:19 and IP address 172.16.0.100
DEBUG: Listening for incoming connection...
New connection from 192.168.0.50:16828.
hello world
hello client
Oh!!!!!!!
DEBUG: Inbound stream from 192.168.0.50:16828 finished cleanly.
DEBUG: Waiting for clean shutdown... DEBUG: Outbound stream to 192.168.0.50:16828 finished (1 byte still in flight).
DEBUG: Outbound stream to 192.168.0.50:16828 has been fully acknowledged.
DEBUG: TCP connection finished cleanly.
done.
Exiting... done.

client

➜  build git:(master) ./apps/lab7 client cs144.keithw.org 3001
DEBUG: Network interface has Ethernet address 02:00:00:32:12:73 and IP address 192.168.0.1
DEBUG: Network interface has Ethernet address 02:00:00:da:5c:7d and IP address 10.0.0.192
DEBUG: adding route 192.168.0.0/16 => (direct) on interface 0
DEBUG: adding route 10.0.0.0/8 => (direct) on interface 1
DEBUG: adding route 172.16.0.0/12 => 10.0.0.172 on interface 1
DEBUG: Network interface has Ethernet address 6e:18:17:8b:27:38 and IP address 192.168.0.50
DEBUG: Connecting from 192.168.0.50:16828...
DEBUG: Connecting to 172.16.0.100:1234...
Successfully connected to 172.16.0.100:1234.
hello world
hello client
Oh!!!!!!!
DEBUG: Outbound stream to 172.16.0.100:1234 finished (1 byte still in flight).
DEBUG: Outbound stream to 172.16.0.100:1234 has been fully acknowledged.
DEBUG: Inbound stream from 172.16.0.100:1234 finished cleanly.
DEBUG: Waiting for lingering segments (e.g. retransmissions of FIN) from peer...
DEBUG: Waiting for clean shutdown... DEBUG: TCP connection finished cleanly.
done.
Exiting... done.

Section 4

server启动后会等待连接到来才发送数据因此可以先执行。但是有个巨大的问题就是不是很稳定而且发送极其缓慢只能耐心了。

server

➜  build git:(master) ✗ dd if=/dev/urandom bs=1M count=1 of=/tmp/big.txt
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00460547 s, 228 MB/s
➜  build git:(master) ✗ ./apps/lab7 server cs144.keithw.org 3000 < /tmp/big.txt 
DEBUG: Network interface has Ethernet address 02:00:00:f0:8f:3f and IP address 172.16.0.1
DEBUG: Network interface has Ethernet address 02:00:00:82:df:65 and IP address 10.0.0.172
DEBUG: adding route 172.16.0.0/12 => (direct) on interface 0
DEBUG: adding route 10.0.0.0/8 => (direct) on interface 1
DEBUG: adding route 192.168.0.0/16 => 10.0.0.192 on interface 1
DEBUG: Network interface has Ethernet address 86:87:fa:05:41:74 and IP address 172.16.0.100
DEBUG: Listening for incoming connection...
New connection from 192.168.0.50:25255.
DEBUG: Inbound stream from 192.168.0.50:25255 finished cleanly.
DEBUG: Waiting for clean shutdown... DEBUG: Outbound stream to 192.168.0.50:25255 finished (64000 bytes still in flight).
DEBUG: Outbound stream to 192.168.0.50:25255 has been fully acknowledged.
DEBUG: TCP connection finished cleanly.
done.
Exiting... done.

client

➜  build git:(master) ✗ </dev/null ./apps/lab7 client cs144.keithw.org 3001 > /tmp/big-received.txt
DEBUG: Network interface has Ethernet address 02:00:00:fe:a0:99 and IP address 192.168.0.1
DEBUG: Network interface has Ethernet address 02:00:00:31:4a:3c and IP address 10.0.0.192
DEBUG: adding route 192.168.0.0/16 => (direct) on interface 0
DEBUG: adding route 10.0.0.0/8 => (direct) on interface 1
DEBUG: adding route 172.16.0.0/12 => 10.0.0.172 on interface 1
DEBUG: Network interface has Ethernet address 3e:6d:08:df:93:af and IP address 192.168.0.50
DEBUG: Connecting from 192.168.0.50:25255...
DEBUG: Connecting to 172.16.0.100:1234...
Successfully connected to 172.16.0.100:1234.
DEBUG: Outbound stream to 172.16.0.100:1234 finished (1 byte still in flight).
DEBUG: Outbound stream to 172.16.0.100:1234 has been fully acknowledged.
DEBUG: Inbound stream from 172.16.0.100:1234 finished cleanly.
DEBUG: Waiting for lingering segments (e.g. retransmissions of FIN) from peer...
DEBUG: Waiting for clean shutdown... DEBUG: TCP connection finished cleanly.
done.
Exiting... done.
➜  sponge git:(master) ✗ sha256sum /tmp/big.txt
f2c54a920a34e125ea4478735f5f07af926c40abe9f0f695272b689370ce6782  /tmp/big.txt
➜  sponge git:(master) ✗ sha256sum /tmp/big-received.txt
f2c54a920a34e125ea4478735f5f07af926c40abe9f0f695272b689370ce6782  /tmp/big-received.txt

离谱的发送时间

发了快8分钟才发完下面的log显示发600K花了4分多钟大概重传了不知道多少次了已经本来打算分析一波原因的但是这网卡都是走的自己写的压根没办法抓包啊只能看他打印的 debug过于抽象所以就没分析了。不过大概率是外部设备的问题国内网络环境比较的复杂不过能发完应该就问题不大了大雾

➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 451K Feb 18 15:42 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt
➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 528K Feb 18 15:42 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt
➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 654K Feb 18 15:44 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt
➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 875K Feb 18 15:45 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt
➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 922K Feb 18 15:45 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt
➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 985K Feb 18 15:46 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt
➜  sponge git:(master) ✗ ls -lh /tmp | grep big
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:46 big-received.txt
-rw-rw-r-- 1 catfood catfood 1.0M Feb 18 15:29 big.txt

Group portion:

没有人和我一起玩(哇哇大哭~

Creative portion (optional): []

Other remarks: []

  • Optional: I had unexpected difficulty with: [describe]

  • Optional: I think you could make this lab better by: [describe]

  • Optional: I was surprised by: [describe]

  • Optional: I'm not sure about: [发的多少有点慢的离谱,不知道是哪里的问题]

完结撒花。虽然不知道以后这个实验的服务器会不会继续开着,因为有些实验,还不得不用它的服务器,如果没了就做不了了捏。