1curl_easy_send(3) libcurl Manual curl_easy_send(3)
2
3
4
6 curl_easy_send - sends raw data over an "easy" connection
7
9 #include <curl/easy.h>
10
11 CURLcode curl_easy_send( CURL *curl, const void *buffer, size_t bu‐
12 flen, size_t *n);
13
15 This function sends arbitrary data over the established connection. You
16 may use it together with curl_easy_recv(3) to implement custom proto‐
17 cols using libcurl. This functionality can be particularly useful if
18 you use proxies and/or SSL encryption: libcurl will take care of proxy
19 negotiation and connection set-up.
20
21 buffer is a pointer to the data of length buflen that you want sent.
22 The variable n points to will receive the number of sent bytes.
23
24 To establish the connection, set CURLOPT_CONNECT_ONLY(3) option before
25 calling curl_easy_perform(3) or curl_multi_perform(3). Note that
26 curl_easy_send(3) will not work on connections that were created with‐
27 out this option.
28
29 The call will return CURLE_AGAIN if it's not possible to send data
30 right now - the socket is used in non-blocking mode internally. When
31 CURLE_AGAIN is returned, use your operating system facilities like se‐
32 lect(2) to wait until the socket is writable. The socket may be ob‐
33 tained using curl_easy_getinfo(3) with CURLINFO_ACTIVESOCKET(3).
34
35 Furthermore if you wait on the socket and it tells you it's writable,
36 curl_easy_send(3) may return CURLE_AGAIN if the only data that was sent
37 was for internal SSL processing, and no other data could be sent.
38
39
41 Added in 7.18.2.
42
44 On success, returns CURLE_OK and stores the number of bytes actually
45 sent into *n. Note that this may very well be less than the amount you
46 wanted to send.
47
48 On failure, returns the appropriate error code.
49
50 This function may return CURLE_AGAIN. In this case, use your operating
51 system facilities to wait until the socket is writable, and retry.
52
53 If there's no socket available to use from the previous transfer, this
54 function returns CURLE_UNSUPPORTED_PROTOCOL.
55
57 See sendrecv.c in docs/examples directory for usage example.
58
60 curl_easy_setopt(3), curl_easy_perform(3), curl_easy_getinfo(3),
61 curl_easy_recv(3)
62
63
64
65libcurl 7.79.1 November 05, 2020 curl_easy_send(3)