linux: Socket question
Hi, I would like to know if there''s a way of making a TCP socket timeout after it has been blocking, waiting to read for a while. I googled a little and it seems like I am supposed to setsockopt with SO_RCVTIMEO.
Would this work with TCP sockets in linux? If so, how does one tell if the socket timed out, either completely or partially (got a part of the data it was waiting for but not all)?
If I understand things correctly, a struct timeval parameter is also to be sent to setsockopt. Is this correct?
Ok, nevermind the above. It is definitely not the correct way to do it, especially considering SO_RCVTIMEO is apparently read-only.
I guess I just have redesign my classes to use select(). *sigh*
I guess I just have redesign my classes to use select(). *sigh*
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement