SO_RCVTIMEO not working for nonblocking win32 socket
-
Hello, I had set timeout with int n = 20000; setsockopt(ClientSocket,SOL_SOCKET,SO_RCVTIMEO,(char*)&n,sizeof(int); and set mode nonblocking with function call int iMode = 1; ioctlsocket(ClientSocket,FIONBIO,(u_long FAR*)&iMode) if i set mode to nonblocking than timeout is not called in recv(). but if i do it with mode blocking (default) than every thing is working fine and timeout called.but i have to work with non blocking mode so anybody can tell me how can i set timeout in nonblocking socket. or why i dont get timeout ,i missed something plz reply. Thanx in advance. :)
-
Hello, I had set timeout with int n = 20000; setsockopt(ClientSocket,SOL_SOCKET,SO_RCVTIMEO,(char*)&n,sizeof(int); and set mode nonblocking with function call int iMode = 1; ioctlsocket(ClientSocket,FIONBIO,(u_long FAR*)&iMode) if i set mode to nonblocking than timeout is not called in recv(). but if i do it with mode blocking (default) than every thing is working fine and timeout called.but i have to work with non blocking mode so anybody can tell me how can i set timeout in nonblocking socket. or why i dont get timeout ,i missed something plz reply. Thanx in advance. :)
one Suggestion re posting questions will not help you to get answers. Now i am not sure if this will answer the problem but i will try. 1. Blocking socket and time out set. This is ideal condition since it is a blocking call After timeout it will come out of the blocking call if nothing to receive. 2. Non blocking and time out set. Since this is the non blocking call it will come out immediately so there is no need of timeout rather even if it is set you will not get it because if there is nothing to receive call will return.. I hope that makes sense.
Regards, Sandip.