(2)send数据细节
来源:互联网 发布:狸窝音频转换器mac版 编辑:程序博客网 时间:2024/06/07 13:56
Nagle’s algorithm
inhibit the sending of new TCP segments when new outgoing data arrives from the user if any previously transmitted data on the connection remains unacknowledged.
Where MSS is the maximum segment size, the largest segment that can be sent on this connection, and the window size is the currently acceptable window of unacknowledged data, this can be written in pseudocode as
if there is new data to send if the window size >= MSS and available data is >= MSS send complete MSS segment now else if there is unconfirmed data still in the pipe enqueue data in the buffer until an acknowledge is received(就是这个地方,要等前面的已发送的包全部被ack才继续放送这个小于MSS的包) else send data immediately end if end ifend if
This algorithm interacts badly with TCP delayed acknowledgments, a feature introduced into TCP at roughly the same time in the early 1980s, but by a different group. With both algorithms enabled, applications that do two successive writes to a TCP connection, followed by a read that will not be fulfilled until after the data from the second write has reached the destination, experience a constant delay of up to 500 milliseconds, the “ACK delay”. For this reason, TCP implementations usually provide applications with an interface to disable the Nagle algorithm. This is typically called the TCP_NODELAY option.
开启 TCP_NODELAY
简单地说,这个选项的作用就是禁用 Nagle’s Algorithm,禁止后当然就不会有 它引起的一系列问题了。在 UNIX C 里使用 setsockopt 可以做到:
void _set_tcp_nodelay(int fd) {
int enable = 1;
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&enable, sizeof(enable));
}
- (2)send数据细节
- Send()函数有关数据
- send断点数据地址
- 数据细节
- send成功但是数据还在Send-Q中
- Send / Recv Usage(2)
- send
- send
- send
- Send
- 数据整理细节
- send(经socket传送数据)
- 16.3.3 发送网络数据send()
- expect_out(buffer)中包含send的数据
- PB Send()函数应用有关数据整理
- C语言socket send()数据缓存问题
- PB Send()函数应用有关数据整理
- TCP send函数 阻塞发送数据详解
- 程序员免费自学编程的12个网站-从现在开始提高自己!
- Activity的addContentView()
- Java+7+Pocket+Guide 2C+2nd Edition.pdf 英文原版 免费下载
- Excel在统计分析中的应用—第七章—参数估计-总体比例之差的估计
- [FMX] 在Android/iOS 应用中判断上网的网络类型
- (2)send数据细节
- 插入排序-1
- 【HTML5】响应式图片
- [教程]如何降低 Delphi 编码后的 Debug 版本的程序体积
- h5 场景动画效果相关插件 aos.js 和 swiper.animate.js
- 云ERP第一:为什么选择NetSuite?
- ffmpeg系列:使用C++类封装ffmpeg,封装视频帧解码功能Decode()方法
- 数学建模(一)线性规划问题
- 模拟字符串有关功能库函数实现