ioLibrary_Driver
ioLibrary_Driver copied to clipboard
recv() timeout in TCP socket
While operating a socket in TCP mode, we use recv() to wait for data from our peer. In case we are the client and send some request to server we want to wait for certain time for response. But the recv() function doesn't provide any method to specify the timeout. It always wait indefinitely (using while(1) loop).
Both WinSock (MS Windows) and Linux OS provide a method to set receive timeout using the function setsockopt() and SO_RCVTIMEO