I have written a TCP Socket application in vc++ 2008. I want 'send' operation to be timed out if it takes more than x seconds. For that I tried using
char *optValue = "5000";
setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, optValue, sizeof(optValue));
It returns success, but 'send' didn't behave as expected. Then tried with
tv.tv_sec = 10;
tv.tv_usec = 0;
FD_SET(accept_socket, &write_mask);
select(socket, (fd_set *)0, &write_mask, (fd_set *)0, &tv);
Still 'send' is not behaving according to the timeout value set. Please check is it the right way to do?