首页 > 学院 > 开发设计 > 正文

udp改变缓冲区大小

2019-11-06 07:51:07
字体:
来源:转载
供稿:网友

windows:

包含的头文件#include <WinSock.h>

int nRecvBuf=64*1024;//设置为64Ksetsockopt(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发送队列大小


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表