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

NAME

6       curl_easy_send - sends raw data over an "easy" connection
7

SYNOPSIS

9       #include <curl/easy.h>
10
11       CURLcode  curl_easy_send(  CURL  *curl,  const  void  *buffer,   size_t
12       buflen, size_t *n);
13

DESCRIPTION

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 option before
25       calling curl_easy_perform(3). Note that curl_easy_send(3) will not work
26       on connections that were created without this option.
27
28       You   must   ensure   that   the  socket  is  writable  before  calling
29       curl_easy_send(3), otherwise the call will  return  CURLE_AGAIN  -  the
30       socket  is  used  in  non-blocking  mode internally. Use curl_easy_get‐
31       info(3) with CURLINFO_LASTSOCKET to obtain the socket; use your operat‐
32       ing system facilities like select(2) to check if it can be written to.
33

AVAILABILITY

35       Added in 7.18.2.
36

RETURN VALUE

38       On  success,  returns  CURLE_OK and stores the number of bytes actually
39       sent into *n. Note that this may very well be less than the amount  you
40       wanted to send.
41
42       On failure, returns the appropriate error code.
43
44       If  there's no socket available to use from the previous transfer, this
45       function returns CURLE_UNSUPPORTED_PROTOCOL.
46

EXAMPLE

48       See sendrecv.c in docs/examples directory for usage example.
49

SEE ALSO

51       curl_easy_setopt(3),    curl_easy_perform(3),     curl_easy_getinfo(3),
52       curl_easy_recv(3)
53
54
55
56libcurl 7.18.2                   29 April 2008               curl_easy_send(3)
Impressum