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
12       only);
13

DESCRIPTION

15       Pass a long. If the parameter equals 1, it tells the library to perform
16       all the required proxy authentication and connection setup, but no data
17       transfer, and then return.
18
19       The option can be used to simply test a connection to a server, but  is
20       more  useful  when  used  with  the  CURLINFO_ACTIVESOCKET(3) option to
21       curl_easy_getinfo(3) as the library can set up the connection and  then
22       the  application  can  obtain the most recently used socket for special
23       data transfers.
24
25       Transfers marked connect only will not reuse any  existing  connections
26       and connections marked connect only will not be allowed to get reused.
27

DEFAULT

29       0
30

PROTOCOLS

32       HTTP, SMTP, POP3 and IMAP
33

EXAMPLE

35       CURL *curl = curl_easy_init();
36       if(curl) {
37         CURLcode ret;
38         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
39         curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
40         ret = curl_easy_perform(curl);
41         if(ret == CURLE_OK) {
42           /* only connected! */
43         }
44       }
45

AVAILABILITY

47       Added in 7.15.2
48

RETURN VALUE

50       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
51       if not.
52

SEE ALSO

54       CURLOPT_VERBOSE(3),   CURLOPT_HTTPPROXYTUNNEL(3),    curl_easy_recv(3),
55       curl_easy_send(3)
56
57
58
59libcurl 7.76.1                 November 04, 2020       CURLOPT_CONNECT_ONLY(3)
Impressum