WinHttpWebSocketQueryCloseStatus function (winhttp.h)
The WinHttpWebSocketQueryCloseStatus function retrieves the close status sent by a server.
Syntax
WINHTTPAPI DWORD WinHttpWebSocketQueryCloseStatus(
[in] HINTERNET hWebSocket,
[out] USHORT *pusStatus,
[out] PVOID pvReason,
[in] DWORD dwReasonLength,
[out] DWORD *pdwReasonLengthConsumed
);
Parameters
[in] hWebSocket
Type: HINTERNET
Handle to a WebSocket
[out] pusStatus
Type: USHORT*
A pointer to a close status code that will be filled upon return. See WINHTTP_WEB_SOCKET_CLOSE_STATUS for possible values.
[out] pvReason
Type: PVOID
A pointer to a buffer that will receive a close reason on return.
[in] dwReasonLength
Type: DWORD
The length of the pvReason buffer, in bytes.
[out] pdwReasonLengthConsumed
Type: DWORD*
The number of bytes consumed. If pvReason is NULL and dwReasonLength is 0, pdwReasonLengthConsumed will contain the size of the buffer that needs to be allocated by the calling application.
Return value
Type: DWORD
NO_ERROR on success. Otherwise an error code.
Description | |
---|---|
|
There is not enough space in pvReason to write the whole close reason. |
|
No close frame has been received yet. |
|
A parameter is invalid. |
Remarks
Call WinHttpWebSocketQueryCloseStatus only after WinHttpWebSocketClose succeeds or if WinHttpWebSocketReceive returns WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE.
pdwReasonLengthConsumed will never be greater than 123, so allocating buffer with at least 123 will guarantee that ERROR_INSUFFICIENT_BUFFER will never be returned.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps only] |
Minimum supported server | Windows Server 2012 [desktop apps only] |
Target Platform | Windows |
Header | winhttp.h |
Library | Winhttp.lib |
DLL | Winhttp.dll |