Is there a way to set a receive timeout on (synchronous) calls to WinHttpWebSocketReceive?
I've tried WinHttpSetTimeouts but that doesn't seem to work.
Asked
Active
Viewed 83 times
0

Stijn Sanders
- 35,982
- 11
- 45
- 67
-
I believe `WinHttpSetTimeouts()` only works for HTTP. Although WebSocket does use HTTP for the initial handshake, once the connection is operating in full WebSocket mode then HTTP timeouts no longer apply. – Remy Lebeau Mar 29 '23 at 22:51
-
Use WinHTTP APIs with timeout options. After [upgrading from http to websocket](https://github.com/microsoft/Windows-classic-samples/blob/7cbd99ac1d2b4a0beffbaba29ea63d024ceff700/Samples/WinhttpWebsocket/cpp/WinhttpWebsocket.cpp#L76), It's unknown if timeout options work. – YangXiaoPo-MSFT Mar 30 '23 at 01:48