1curl_ws_recv(3)                 libcurl Manual                 curl_ws_recv(3)
2
3
4

NAME

6       curl_ws_recv - receive WebSocket data
7

SYNOPSIS

9       #include <curl/easy.h>
10
11       CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
12                             size_t *recv, struct curl_ws_frame **meta);
13

DESCRIPTION

15       This function call is EXPERIMENTAL.
16
17       Retrieves  as  much  as  possible of a received WebSocket data fragment
18       into the buffer, but not more than buflen bytes. recv  is  set  to  the
19       number of bytes actually stored.
20
21       If  there  is  more fragment data to deliver than what fits in the pro‐
22       vided buffer, libcurl returns a full buffer and the  application  needs
23       to call this function again to continue draining the buffer.
24
25       The  meta pointer gets set to point to a struct curl_ws_frame that con‐
26       tains information about the received data. See the curl_ws_meta(3)  for
27       details on that struct.
28

EXAMPLE

30         size_t rlen;
31         struct curl_ws_frame *meta;
32         char buffer[256];
33         CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta);
34

AVAILABILITY

36       Added in 7.86.0.
37

RETURN VALUE

39       Returns  CURLE_OK  if everything is okay, and a non-zero number for er‐
40       rors. Returns CURLE_GOT_NOTHING if the associated connection is closed.
41
42       Instead of blocking, the function returns CURLE_AGAIN. The correct  be‐
43       havior  is  then  to  wait  for the socket to signal readability before
44       calling this function again.
45

SEE ALSO

47       curl_easy_setopt(3),    curl_easy_perform(3),     curl_easy_getinfo(3),
48       curl_ws_send(3)
49
50
51
52libcurl 8.0.1                   March 16, 2023                 curl_ws_recv(3)
Impressum