Read the original speed -TCP / IP (UDP example)

Chapter 11 UDP: User Datagram Protocol

11.4 A simple example

With a sock program we have written to generate some by UDP datagram tcpdump observation:
Here Insert Picture Description
when the first execution of this program, we specify verbose mode (- v) to observe the ephemeral port number, specify the UDP (- u) instead of the default the TCP, and specifies the source mode (- i) to send data, instead of the standard read and write inputs and outputs. - n 4 4 option indicates that the output data packet parts (default condition 1024), the destination host 4 of SVR. In a 1 2 describes disposal service. Every write output length of the default value 1024. When the second run of the program we specify - w 0, meaning that the length of the datagram write 0. Tcpdump output two orders FIG 11-- 6 shown in FIG.
Here Insert Picture Description
Output display shows four 1024-byte packets, and then there are four data packets of length 0. Each data packet interval of a few milliseconds (the second input command took 41 seconds).

Before sending the first data packet parts, there is no communication between the sending end and the receiving end (at Chapter 17, we will see the TCP connection must be established before the other end of the first byte of data transmission). Further, when data is received, the receiver is not any confirmation. In this case, the sender does not know whether the other end of the data packet has been received.

Finally, it is noted that, each time the program is run, the source UDP port numbers are changed. The first is 1108, then 110. In Section 1.9 we have already mentioned, the client ephemeral port number used is generally between 1024 ~ 5000, as we see it.

Released 1489 original articles · won praise 1394 · Views 120,000 +

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/104695328