WinHttpWebSocketReceive function

The WinHttpWebSocketReceive function receives data from a WebSocket connection.

Syntax


DWORD WINAPI WinHttpWebSocketReceive(
  _In_   HINTERNET hWebSocket,
  _Out_  PVOID pvBuffer,
  _In_   DWORD dwBufferLength,
  _Out_  DWORD *pdwBytesRead,
  _Out_  WINHTTP_WEB_SOCKET_BUFFER_TYPE *peBufferType
);

Parameters

hWebSocket [in]

Type: HINTERNET

Handle to a WebSocket.

pvBuffer [out]

Type: PVOID

Pointer to a buffer to receive the data.

dwBufferLength [in]

Type: DWORD

Length of pvBuffer, in bytes.

pdwBytesRead [out]

Type: DWORD*

Pointer to a DWORD that receives the number of bytes read from the connection at the end of the operation. This is set only if WinHttpWebSocketReceive returns NO_ERROR and the handle was opened in synchronous mode.

peBufferType [out]

Type: WINHTTP_WEB_SOCKET_BUFFER_TYPE*

The type of a returned buffer. This is only set if WinHttpWebSocketReceive returns NO_ERROR and the handle was opened in synchronous mode.

Return value

Type: DWORD

NO_ERROR on success. Otherwise an error code.

Description
ERROR_INVALID_OPERATION

A close or send is pending, or the receive channel has already been closed.

ERROR_INVALID_PARAMETER

A parameter is invalid.

ERROR_INVALID_SERVER_RESPONSE

Invalid data was received from the server.

ERROR_WINHTTP_OPERATION_CANCELLED

The operation was cancelled because WinHttpWebSocketClose was called to close the connection.

 

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Winhttp.h

Library

Winhttp.lib

DLL

Winhttp.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft