UDP的概念
UDP 是User Datagram Protocol的简称, 中文名是用户数据报协议,是OSI(Open System Interconnection,开放式系统互联) 参考模型中一种无连接的传输层协议,提供面向事务的简单不可靠信息传送服务,IETF RFC 768是UDP的正式规范。UDP在IP报文的协议号是17。
流量控制
对于一个带宽1Gbps, RTT为100ms的网络来说
BDP=1,000,000,000*0.1/8=12,500,000字节=12207K=12M
传统TCP接收窗口大小=65535byte=64K, 显然满足不了
udt使用包大小1500byte, 默认接口窗口大小为8192, 因此
接收窗口的大小为=1500*8192=12,288,000字节=12000K=11.7M
因此, 可以看到udt的默认设置已经足够.
Congestion Control(拥塞控制)
1. 两个重要的参数:
congestion window size and the inter-packet sending interval
2. 主要的接口
1) init: when the UDT socket is connected.
2) close: when the UDT socket is closed.
3) onACK: when ACK is received.
4) onLOSS: when NACK is received.
5) onTimeout: when timeout occurs.
6) onPktSent: when a data packet is sent.
7) onPktRecv: when a data packet is received.
3. udt的拥塞算法:
On ACK packet received:
1) If the current status is in the slow start phase, set the
congestion window size to the product of packet arrival rate and
(RTT + SYN). Slow Start ends. Stop.
2) Set the congestion window size (CWND) to: CWND = A * (RTT + SYN) +16.
3) The number of sent packets to b