aboutsummaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_easy_recv.3
diff options
context:
space:
mode:
Diffstat (limited to 'docs/libcurl/curl_easy_recv.3')
-rw-r--r--docs/libcurl/curl_easy_recv.323
1 files changed, 18 insertions, 5 deletions
diff --git a/docs/libcurl/curl_easy_recv.3 b/docs/libcurl/curl_easy_recv.3
index 3212e2c37..e23f381bb 100644
--- a/docs/libcurl/curl_easy_recv.3
+++ b/docs/libcurl/curl_easy_recv.3
@@ -5,11 +5,11 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
-.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" * are also available at https://curl.se/docs/copyright.html.
.\" *
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
.\" * copies of the Software, and permit persons to whom the Software is
@@ -20,7 +20,7 @@
.\" *
.\" **************************************************************************
.\"
-.TH curl_easy_recv 3 "December 18, 2016" "libcurl 7.73.0" "libcurl Manual"
+.TH curl_easy_recv 3 "October 31, 2021" "libcurl 7.80.0" "libcurl Manual"
.SH NAME
curl_easy_recv - receives raw data on an "easy" connection
@@ -61,7 +61,22 @@ read which would include any cached data.
Furthermore if you wait on the socket and it tells you there is data to read,
\fIcurl_easy_recv(3)\fP may return \fBCURLE_AGAIN\fP if the only data that was
read was for internal SSL processing, and no other data is available.
+.SH EXAMPLE
+.nf
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ /* Do not do the transfer - only connect to host */
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
+ res = curl_easy_perform(curl);
+
+ if(res == CURLE_OK) {
+ /* Extract the socket from the curl handle -
+ we will need it for waiting. */
+ res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
+ /* read data */
+ res = curl_easy_recv(curl, buf, sizeof(buf), &nread);
+ }
+.fi
.SH AVAILABILITY
Added in 7.18.2.
.SH RETURN VALUE
@@ -77,8 +92,6 @@ Reading exactly 0 bytes indicates a closed connection.
If there's no socket available to use from the previous transfer, this function
returns \fBCURLE_UNSUPPORTED_PROTOCOL\fP.
-.SH EXAMPLE
-See \fBsendrecv.c\fP in \fBdocs/examples\fP directory for usage example.
.SH "SEE ALSO"
.BR curl_easy_setopt "(3), " curl_easy_perform "(3), "
.BR curl_easy_getinfo "(3), "