WebSocketReceive function

The WebSocketReceive function adds a receive operation to the protocol component operation queue.

Syntax


HRESULT WINAPI WebSocketReceive(
  _In_      WEB_SOCKET_HANDLE hWebSocket,
  _In_opt_  WEB_SOCKET_BUFFER *pBuffer,
  _In_opt_  PVOID pvContext
);

Parameters

hWebSocket [in]

Type: WEB_SOCKET_HANDLE

WebSocket session handle returned by a previous call to WebSocketCreateClientHandle or WebSocketCreateServerHandle.

pBuffer [in, optional]

Type: WEB_SOCKET_BUFFER*

A pointer to an array of WEB_SOCKET_BUFFER structures that WebSocket data will be written to when it is returned by WebSocketGetAction. If NULL, WebSocketGetAction will return an internal buffer that enables zero-copy scenarios.

Note  Once WEB_SOCKET_INDICATE_RECEIVE_COMPLETE is returned by WebSocketGetAction for this action, the memory pointer to by pBuffer can be reclaimed.

pvContext [in, optional]

Type: PVOID

A pointer to an application context handle that will be returned by a subsequent call to WebSocketGetAction.

Return value

Type: HRESULT

If the function succeeds, it returns S_OK.

If the function fails, it returns one of the following or a system error code defined in WinError.h.

Return codeDescription
E_INVALID_PROTOCOL_OPERATION

Protocol performed an invalid operation.

 

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Websocket.h

Library

Websocket.lib

DLL

Websocket.dll

See also

WEB_SOCKET_ACTION
WebSocketAbortHandle
WebSocketCompleteAction
WebSocketGetAction
WebSocketSend

 

 

Community Additions

ADD
Show:
© 2014 Microsoft