I am trying to set RCVBUF to 1MB//1048576 , But after setting the value when I am trying to read it through getsockopt it always gives the value as 2MB//2097152 could anyone let me know what is the problem with the below code?
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;
Here is what is said in
man 7 socket
regarding SO_RCVBUF option: