Microsoft KB Archive/169452

{| = BUG: Setting a Receive Timeout on a Raw Socket Has No Effect =
 * width="100%"|

Last reviewed: June 2, 1997

Article ID: Q169452 The information in this article applies to:
 * Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows NT version 4.0

SYMPTOMS
When you set a receive timeout on a raw socket, a blocking receive call posted on that socket (which is supposed to timeout if no data is received) blocks indefinitely.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
The following code segment is normally used to make a receive call timeout if no data is received within a given period of time:

SOCKET socket; int timeout = 1000;  // Desired timeout in milliseconds

retval = setsockopt (socket,                       SOL_SOCKET,                        SO_RCVTIMEO,                        (char*)&timeout,                        sizeof(timeout)); This code sets a timeout on a normal socket. If you use a raw socket instead, the API succeeds. However, as a result of the bug mentioned above, it has no influence on the behavior of the socket. To work around this problem, use the select API with a timeout value prior to posting a blocking receive call.
 * }