Can anyone confirm that socket receive timeout is supported?
Posted: Mon Nov 12, 2018 5:29 pm
I'm setting a socket read timeout but still seeing it (I think) hang in read().
Does anyone know, or can anyone confirm, that it's actually supported correctly? My assumption/expectation is that if I ask for 1024 bytes and, let's say, 703 come in and then nothing further, that it'll time out after 3 seconds. But it doesn't seem to, at least not reliably.
Code: Select all
struct timeval to;
to.tv_sec = 3;
to.tv_usec = 0;
if (setsockopt(new_socket,SOL_SOCKET,SO_RCVTIMEO,&to,sizeof(to)) < 0)
{
Serial.printf("Unable to set read timeout on socket!");
return false;
}