我正在尝试将 RCVBUF 设置为 1MB//1048576 ,但是在我尝试通过 getsockopt 读取它时设置该值后,它总是将值设为 2MB//2097152 谁能告诉我下面的代码有什么问题?
unsigned int rcvBuf = getRcvBufValue();
if (setsockopt (channelfd, SOL_SOCKET, SO_RCVBUF, &rcvBuf,sizeof (rcvBuf)) == -1)
{
cout<<"RCV BUF IS NOT SET";
}
int rcvbuf = -1;
socklen_t Rsize = sizeof(rcvbuf);
getsockopt (channelfd, SOL_SOCKET, SO_RCVBUF,&rcvbuf,&Rsize);
cout<<rcvbuf;