⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcpandudp.txt

📁 ssd8 exercise 3 Write a simple datagram client/server in Java and a tcp client/server also in java
💻 TXT
字号:
Run the client on my machine and my server on my friend's machine.

UDP: 
The average round trip time is: 0.359 vs
The number of packets lost and duplicated is: 0

TCP 
The number of packets lost and duplicated is: 0
The average round trip time to send one byte with TCP is: 1.641 vs


Using ping to measure:
1.ping my friend's computer:
C:\Documents and Settings\xiangyanfei.PC190843082418>ping 192.168.1.100 -l 50000


Pinging 192.168.1.100 with 50000 bytes of data:

Reply from 192.168.1.100: bytes=50000 time=10ms TTL=128
Reply from 192.168.1.100: bytes=50000 time=10ms TTL=128
Reply from 192.168.1.100: bytes=50000 time=10ms TTL=128
Reply from 192.168.1.100: bytes=50000 time=10ms TTL=128

Ping statistics for 192.168.1.100:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 10ms, Maximum = 10ms, Average = 10ms

2.ping my own computer:
C:\Documents and Settings\xiangyanfei.PC190843082418>ping 192.168.1.102 -l 50000


Pinging 192.168.1.102 with 50000 bytes of data:

Reply from 192.168.1.102: bytes=50000 time=1ms TTL=128
Reply from 192.168.1.102: bytes=50000 time<1ms TTL=128
Reply from 192.168.1.102: bytes=50000 time<1ms TTL=128
Reply from 192.168.1.102: bytes=50000 time<1ms TTL=128

Ping statistics for 192.168.1.102:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

It should take 1 packet to send one byte over UDP.
It take 5 packets to establish a TCP connection, send one byte, and close the connection.
THe result is what I expected. Because tcp need more information to check the packet so it need more packets to send the same number bytes. And tcp should three-handshaking, so it takes more time.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -