Microsoft KB Archive/169452: Difference between revisions
m (Text replacement - """ to """) |
m (Text replacement - "&" to "&") |
||
Line 30: | Line 30: | ||
SOL_SOCKET, | SOL_SOCKET, | ||
SO_RCVTIMEO, | SO_RCVTIMEO, | ||
(char*)& | (char*)&timeout, | ||
sizeof(timeout)); | sizeof(timeout)); | ||
</pre> | </pre> |
Latest revision as of 12:29, 21 July 2020
BUG: Setting a Receive Timeout on a Raw Socket Has No EffectLast reviewed: June 2, 1997 |
The information in this article applies to:
SYMPTOMSWhen 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. STATUSMicrosoft 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 INFORMATIONThe 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. |
Keywords : kbnetwork NtwkWinsock Last reviewed: June 2, 1997 |