1CURLOPT_CONNECT_ONLY(3)    curl_easy_setopt options    CURLOPT_CONNECT_ONLY(3)
2
3
4

NAME

6       CURLOPT_CONNECT_ONLY - stop when connected to target server
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_ONLY, long only);
12

DESCRIPTION

14       Pass a long. If the parameter equals 1, it tells the library to perform
15       all the required proxy authentication and connection setup, but no data
16       transfer, and then return.
17
18       The  option can be used to simply test a connection to a server, but is
19       more useful when  used  with  the  CURLINFO_ACTIVESOCKET(3)  option  to
20       curl_easy_getinfo(3)  as the library can set up the connection and then
21       the application can obtain the most recently used  socket  for  special
22       data transfers.
23
24       Transfers  marked  connect only will not reuse any existing connections
25       and connections marked connect only will not be allowed to get reused.
26
27       If the connect only transfer is done using  the  multi  interface,  the
28       particular  easy  handle  must  remain added to the multi handle for as
29       long as the application wants to use it. Once it has been removed  with
30       curl_multi_remove_handle(3), curl_easy_send(3) and curl_easy_recv(3) do
31       not function.
32

DEFAULT

34       0
35

PROTOCOLS

37       HTTP, SMTP, POP3 and IMAP
38

EXAMPLE

40       CURL *curl = curl_easy_init();
41       if(curl) {
42         CURLcode ret;
43         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
44         curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
45         ret = curl_easy_perform(curl);
46         if(ret == CURLE_OK) {
47           /* only connected! */
48         }
49       }
50

AVAILABILITY

52       Added in 7.15.2
53

RETURN VALUE

55       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
56       if not.
57

SEE ALSO

59       CURLOPT_VERBOSE(3),    CURLOPT_HTTPPROXYTUNNEL(3),   curl_easy_recv(3),
60       curl_easy_send(3)
61
62
63
64libcurl 7.85.0                  August 07, 2022        CURLOPT_CONNECT_ONLY(3)
Impressum