summaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_easy_send.3
diff options
context:
space:
mode:
Diffstat (limited to 'docs/libcurl/curl_easy_send.3')
-rw-r--r--docs/libcurl/curl_easy_send.319
1 files changed, 16 insertions, 3 deletions
diff --git a/docs/libcurl/curl_easy_send.3 b/docs/libcurl/curl_easy_send.3
index 535962517..6430c54e0 100644
--- a/docs/libcurl/curl_easy_send.3
+++ b/docs/libcurl/curl_easy_send.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2020, 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
@@ -53,7 +53,22 @@ obtained using \fIcurl_easy_getinfo(3)\fP with \fICURLINFO_ACTIVESOCKET(3)\fP.
Furthermore if you wait on the socket and it tells you it's writable,
\fIcurl_easy_send(3)\fP may return \fBCURLE_AGAIN\fP if the only data that was
sent was for internal SSL processing, and no other data could be sent.
+.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'll need it for waiting. */
+ res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
+ /* send data */
+ res = curl_easy_send(curl, "hello", 5, &sent);
+ }
+.fi
.SH AVAILABILITY
Added in 7.18.2.
.SH RETURN VALUE
@@ -68,8 +83,6 @@ system facilities to wait until the socket is writable, and retry.
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), " curl_easy_getinfo "(3), "
.BR curl_easy_recv "(3) "