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

DEFAULT

26       0
27

PROTOCOLS

29       HTTP, SMTP, POP3 and IMAP
30

EXAMPLE

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

AVAILABILITY

44       Added in 7.15.2
45

RETURN VALUE

47       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
48       if not.
49

SEE ALSO

51       CURLOPT_VERBOSE(3),    CURLOPT_HTTPPROXYTUNNEL(3),   curl_easy_recv(3),
52       curl_easy_send(3)
53
54
55
56libcurl 7.61.1                   May 31, 2017          CURLOPT_CONNECT_ONLY(3)
Impressum