Computer network discovery (f) multiplexing / demultiplexing and UDP protocol

From now on, we begin to learn the transport layer, the sixth edition of the top-down into a transport layer, feel strange

The book hit the analogy between the Postal Service and the collection of a letter sent brothers and sisters, very appropriate

This effect is the difference between the transport and network layers, i.e., the transport layer of the tube is inside the host file transfer
Here Insert Picture Description

Multiplexing and demultiplexing

Multiplexing: the source host to collect data block different sockets, each package's first section information, a segment, and then transmitted to the network segment
demultiplexer: the transport layer data segment delivered to the right (via header information) socket
yourself with the following terms

noun significance
data block Dismantling down data
Segment Transport layer data block to the package's first section information includes source port number and destination port number
Datagram Packaging unit's first information to a network layer segment, including the source IP address and destination IP addresses
Sockets Conduit communicating application layer and the transport layer

In connection-oriented multiplex

This is the internal structure of the segment is
Here Insert Picture Description
connected to the host as shown, with brief segments instead of four port number
Here Insert Picture Description
multiplexing requirements:
Here Insert Picture Description
why this requirement? Because the ultimate goal is to break out, so make sure it can decompose properly, this requirement is decomposed matching service rules

Decomposition services:

  1. Sockets assigned port numbers
  2. Transport layer port numbers to check segment, and oriented to the socket
  3. Data packets are transmitted to the process section is connected via a socket

Above, the transfer process is UDP, but TCP is much more complicated


UDP protocol

UDP protocol is very simple, there is nothing to talk about, but you can lay the foundation for understanding TCP

This is done using UDP protocol segment, header only four fields, each consisting of two bytes, that is, his head is only 8 bytes (TCP head a lot more than he)
Here Insert Picture Description
can see there is a checksum, called a checksum, what is it? Below you know

Specific contents

Here Insert Picture Description
Read the above this figure, you may wonder

1. Since UDP is not reliable, why should he add error checking

This error checking is much simpler than TCP, pay more in a way that can reduce the error rate does not affect the speed of the UDP, will be introduced later

2.UDP reliable transmission can increase it?

Yes, in fact, it is built on TCP protocol based on UDP protocol, but is a good package directly
add application layer mechanism can complete the TCP functions we use UDP by

Checksum

Objective: detecting whether an error occurs in the UDP segment transmission (e.g., bit inversion)
Here Insert Picture Description

for example

First, the sender

  1. Suppose the data has three 16-bit number
  2. And obtained the first two
  3. The first two, and add a third number, if you rewind the overflow, and the highest position and remove, then +1
  4. Now add 16-bit number over all, becomes inverted code and checksum, and then sent

Second, the recipient

  1. The four 16-bit number (including the checksum) together, must be equal to 1,111,111,111,111,111 (equivalent to adding two inverted), which is why the inverse of the code validator and
  2. If ranging checksum error, transmission problems
    Here Insert Picture Description
    'm sure you can think of, this is still too fragile, only missing data can only solve problems, such as 16-bit number exchanged position such errors can not be detected
    and he also only you know that an error has occurred, do not know where the error occurred

The focus is to learn TCP protocol, more than just learning the pre-knowledge of TCP

Published 106 original articles · won praise 89 · views 60000 +

Guess you like

Origin blog.csdn.net/qq_37465638/article/details/88747149