Please, show below example
int val = 120000;
setsockopt(connSock,SOL_SOCKET,SO_RCVTIMEO,(char*)&val,sizeof(int));
I set 120 seconds at receive timeout but it takes 240 seconds.
I think timeout is double the set value.
how is it possible?
SO_RCVTIMEO
does not accept an int
as the timeout. You're looking for something like this:
struct timeval tv = {
.tv_sec = 120
};
setsockopt(connSock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With