--- udp computer network protocol of the transport layer

First, we know you want to be transferred to the transport layer is encapsulated after the application layer of the data package, but at the application layer but the data is processed, so it is necessary to transfer to the process set up at the transport layer, so at the transport layer needs port settings. So the port is a sign of a process, is an application.
A port that can be used by an application
an application can use a plurality of ports

udp protocol format
Here Insert Picture Description

16-bit source port: the process of sending data flag
16-bit destination port number: flag data sent to process
16-bit length udp: represents the maximum length of the entire packet (udp udp header + data), the longest length is 64K. If the data is greater than 64K on sendto given
16-bit checksum udp: summing the binary one. The two bytes of each data transfer negated sum, but without the two-byte 16-bit checksum udp.
udp features

  • no connection
  • Unreliable
  • Datagram-oriented
    connectionless: data sent not need to know when you can send data without establishing a connection, such as we realize the udp access time after our clients can send data directly bind address to send clear partners can look udp code implementation
    is not reliable: under no circumstances is the Internet connection is not reliable, because they do not reply after sending the data, the data received do not know or do not know at the time whether the connection has been connected on.
    Datagram-oriented: the data packet is in accordance with the transmission format. Whole data transmission entire data reception. It will not cause problems stick package.
    udp datagram transmission does not guarantee the order arrives, because the user needs to order management packet at the application layer.
    udp data processing :
    udp entire delivery of data provided to the application layer () does not have half of the data, because the length of the packet header there are shown). It is also because datagram protocol header has said that it will not stick package udp problem.

Guess you like

Origin blog.csdn.net/boke_fengwei/article/details/91041237