curl_easy_send - sends raw data over an "easy" connection
Синтаксис[]
CURLcode curl_easy_send( CURL * curl , const void * buffer , size_t buflen , size_t * n );
Описание[]
Эта функция отправляет необработанные данные через установленное соединение. Вы можете использовать эту функцию совместно с curl_easy_recv(3) для реализации пользовательских протоколов с помощью libcurl. This functionality can be particularly useful if you use proxies and/or SSL encryption: libcurl will take care of proxy negotiation and connection set-up.
buffer is a pointer to the data of length buflen that you want sent. The variable n points to will receive the number of sent bytes.
To establish the connection, set CURLOPT_CONNECT_ONLY option before calling curl_easy_perform(3). Note that curl_easy_send(3) will not work on connections that were created without this option.
Вы должны убедиться, что сокет позволяет запись, до вызова curl_easy_send(3), иначе вернёт ошибку CURLE_AGAIN - the socket is used in non-blocking mode internally. Используйте curl_easy_getinfo(3) с CURLINFO_LASTSOCKET чтобы получить сокет; используйте функционал ОС, такой как select(2) чтобы проверить возможность записи в сокет.
Возвращаемое значение[]
On success, returns CURLE_OK and stores the number of bytes actually sent into *n. Note that this may very well be less than the amount you wanted to send.
On failure, returns the appropriate error code.
См. также[]
Это незавершенная статья Она содержит неполную информацию Вы можете помочь Libcurlru вики, дополнив её. |