我试图在OS X中将delayed_ack值从3(默认)更改为0.我可以通过编程方式更改发送空间,但不能更改delayed_ack。想法?感谢。
int sendspace,retval,new_sendspace,len;
len = sizeof(sendspace);
new_sendspace = 131072;
retval = sysctlbyname("net.inet.tcp.sendspace", &sendspace, &len,&new_sendspace, &len);
以上作品。
// Turn off delayed Ack
int delayed_ack = 0;
len = sizeof(delayed_ack);
retval = sysctlbyname("net.inet.tcp.delayed_ack", &delayed_ack, &len, &delayed_ack,
&len);
printf("retval for delayed ack is %d\n",retval);
delayed_ack永远不会设置为0。
答案 0 :(得分:0)
找到我的答案。这就是你如何做到的。
setsockopt(sockfd,IPPROTO_TCP, TCP_NODELAY,(char *) &flag, sizeof(int));