I am trying to set a 100ms timeout on a UDP Socket. I am using C. I have posted relavent pieces of my code below. I am not sure why this is not timing out, but just hangs
I have the same problem. I tried to adopt the solution you suggested, using the timeval
struct. But it did not seem to work.
I have read on the Microsoft documentation and the time should be a DWORD
with the number of milliseconds, but there is also another thing to do, If the socket is created using the WSASocket
function, then the dwFlags
parameter must have the WSA_FLAG_OVERLAPPED
attribute set for the timeout to function properly.
Otherwise the timeout never takes effect.