网络协议(三)UDP

1、UDP(User Datagram Protocol):用户数据报协议,属于传输层协议。

  udp是无连接不可靠的数据报协议。其具有以下特性:

(1)无连接,即发送数据前不需要建立连接;

(2)尽最大努力交付,即不保证可靠交付;

(3)面向报文,DUP对应用层交下来的报文,既不合并,也不拆分,而是保留这些报文的边界;

(4)没有拥塞(流量)控制;(congestion control/traffic control)

(5)支持一对一、一对多、多对一、多对多的交互通信。

2、udp头部格式

网络协议(三)UDP_第1张图片

网络协议(三)UDP_第2张图片

Source Port is an optional field, when meaningful, it indicates the port of the sending process, and may be assumed to be the port to which a reply should be addressed in the absence of any other information. If not used, a value of zero is inserted.
Destination Port has a meaning within the context of a particular internet destination address.
Length is the length in octets of this user datagram including this header and the data. (This means the minimum value of the length is eight.)
Checksum is the 16-bit one’s complement of the one’s complement sum of a pseudo header of information from the IP header, the UDP header, and the data, padded with zero octets at the end (if necessary) to make a multiple of two octets.
The pseudo header conceptually prefixed to the UDP header contains the source address, the destination address, the protocol, and the UDP length. This information gives protection against misrouted datagrams. This checksum procedure is the same as is used in TCP.


3、UDP基于端口的分用与复用

网络协议(三)UDP_第3张图片


你可能感兴趣的:(网络)