WinHttpWebSocketQueryCloseStatus function
The WinHttpWebSocketQueryCloseStatus function retrieves the close status sent by a server.
Syntax
DWORD WINAPI WinHttpWebSocketQueryCloseStatus( _In_ HINTERNET hWebSocket, _Out_ USHORT *pusStatus, _Out_ PVOID pvReason, _In_ DWORD dwReasonLength, _Out_ DWORD *pdwReasonLengthConsumed );
Parameters
- hWebSocket [in]
-
Type: HINTERNET
Handle to a WebSocket
- pusStatus [out]
-
Type: USHORT*
A pointer to a close status code that will be filled upon return. See WINHTTP_WEB_SOCKET_CLOSE_STATUS for possible values.
- pvReason [out]
-
Type: PVOID
A pointer to a buffer that will receive a close reason on return.
- dwReasonLength [in]
-
Type: DWORD
The length of the pvReason buffer, in bytes.
- pdwReasonLengthConsumed [out]
-
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
|
Minimum supported client |
Windows 8 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2012 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also