WinHttpWebSocketSend function (winhttp.h)

The WinHttpWebSocketSend function sends data over a WebSocket connection.

Syntax

WINHTTPAPI DWORD WinHttpWebSocketSend(
  [in] HINTERNET                      hWebSocket,
  [in] WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType,
  [in] PVOID                          pvBuffer,
  [in] DWORD                          dwBufferLength
);

Parameters

[in] hWebSocket

Type: HINTERNET

Handle to a websocket.

[in] eBufferType

Type: WINHTTP_WEB_SOCKET_BUFFER_TYPE

Type of buffer.

Note  Do not specify WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE. Use WinHttpWebSocketClose or WinHttpWebSocketShutdown to close the connection.

 

[in] pvBuffer

Type: PVOID

Pointer to a buffer containing the data to send. Can be NULL only if dwBufferLength is 0.

[in] dwBufferLength

Type: DWORD

Length of pvBuffer.

Return value

Type: DWORD

NO_ERROR on success. Otherwise an error code.

Description
ERROR_INVALID_OPERATION
A close or send is pending, or the send channel has already been closed.
ERROR_INVALID_PARAMETER
A parameter is invalid.

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

See also

WINHTTP_WEB_SOCKET_BUFFER_TYPE