curl_easy_send.3 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at http://curl.haxx.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .\"
  23. .TH curl_easy_send 3 "29 April 2008" "libcurl 7.18.2" "libcurl Manual"
  24. .SH NAME
  25. curl_easy_send - sends raw data over an "easy" connection
  26. .SH SYNOPSIS
  27. .B #include <curl/easy.h>
  28. .sp
  29. .BI "CURLcode curl_easy_send( CURL *" curl ", const void *" buffer ","
  30. .BI " size_t " buflen ", size_t *" n ");"
  31. .ad
  32. .SH DESCRIPTION
  33. This function sends arbitrary data over the established connection. You may
  34. use it together with \fIcurl_easy_recv(3)\fP to implement custom protocols
  35. using libcurl. This functionality can be particularly useful if you use
  36. proxies and/or SSL encryption: libcurl will take care of proxy negotiation and
  37. connection set-up.
  38. \fBbuffer\fP is a pointer to the data of length \fBbuflen\fP that you want sent.
  39. The variable \fBn\fP points to will receive the number of sent bytes.
  40. To establish the connection, set \fBCURLOPT_CONNECT_ONLY\fP option before
  41. calling \fIcurl_easy_perform(3)\fP. Note that \fIcurl_easy_send(3)\fP will not
  42. work on connections that were created without this option.
  43. You must ensure that the socket is writable before calling
  44. \fIcurl_easy_send(3)\fP, otherwise the call will return \fBCURLE_AGAIN\fP -
  45. the socket is used in non-blocking mode internally. Use
  46. \fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_LASTSOCKET\fP to obtain the
  47. socket; use your operating system facilities like \fIselect(2)\fP to check if
  48. it can be written to.
  49. .SH AVAILABILITY
  50. Added in 7.18.2.
  51. .SH RETURN VALUE
  52. On success, returns \fBCURLE_OK\fP and stores the number of bytes actually
  53. sent into \fB*n\fP. Note that this may very well be less than the amount you
  54. wanted to send.
  55. On failure, returns the appropriate error code.
  56. .SH EXAMPLE
  57. See \fBsendrecv.c\fP in \fBdocs/examples\fP directory for usage example.
  58. .SH "SEE ALSO"
  59. .BR curl_easy_setopt "(3), " curl_easy_perform "(3), " curl_easy_getinfo "(3), "
  60. .BR curl_easy_recv "(3) "