举例说明: SO_RCVBUF和SO_SNDBUF每个套接口都有一个发送缓冲区和一个接收缓冲区,使用这两个套接口选项可以改变缺省缓冲区大小。 // 接收缓冲区 int nRecvBuf=32*1024; //设置为32K setsockopt(s,SOL_SOCKET,SO_RCVBUF,(const char*)&nRecvBuf,sizeof(int)); //发送缓冲区 int nSendBuf=32*1024;//设置...
参见http://stackoverflow.com/questions/4257410/what-are-so-sndbuf-and-so-recvbuf The "SO_" prefix is for "socket option", so yes, these are per-socket settings for the per-socket buffers. There are usually system-wide defaults and maximum values. SO_RCVBUF is simpler to understand: it'...
The "SO_" prefix is for "socket option", so yes, these are per-socket settings for the per-socket buffers. There are usually system-wide defaults and maximum values. SO_RCVBUF is simpler to understand: it's the size of the buffer the kernel allocates to hold the data arriving into th...
socket.recv(fd, buf, size, flag)中buf的size###这个是你自己的缓冲区 和 setsockopt(fd, SOL_SOCKET, SO_RCVBUF, value, valuesize)的value###这个是系统的缓冲区 1. 2. 3.