udp改变缓冲区大小
windows:包含的头文件#includeint nRecvBuf=64*1024;//设置为64Ksetsockopt(listenSocket,SOL_SOCKET, SO_RCVBUF,(const char*)&nRecvBuf,sizeof(int));linux:#include#includestruct ifreq ifr;mem
·
windows:
包含的头文件#include <WinSock.h>
int nRecvBuf=64*1024;//设置为64K
setsockopt(listenSocket,SOL_SOCKET, SO_RCVBUF,(const char*)&nRecvBuf,sizeof(int));
linux:
#include <net/if.h>
#include <sys/ioctl.h>
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name));
ifr.ifr_qlen = 10000;
if (-1 == ioctl(sockfd, SIOCSIFTXQLEN, &ifr))
printf("failed to set dev eth0 queue length");
if (-1 == ioctl(sockfd, SIOCGIFTXQLEN, &ifr))
printf("failed to get dev eth0 queue length");
改变udp发送队列大小
更多推荐
已为社区贡献1条内容
所有评论(0)