WinHttpWebSocketSend function

The WinHttpWebSocketSend function sends data over a WebSocket connection.

Syntax

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

Parameters

hWebSocket

Type: HINTERNET

Handle to a websocket.

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.

 

pvBuffer

Type: PVOID

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

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

   
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