CURLOPT_ABSTRACT_UNIX_SOCKET.md (1769B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_ABSTRACT_UNIX_SOCKET 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_UNIX_SOCKET_PATH (3) 9 - unix (7) 10 Protocol: 11 - All 12 Added-in: 7.53.0 13 --- 14 15 # NAME 16 17 CURLOPT_ABSTRACT_UNIX_SOCKET - abstract Unix domain socket 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ABSTRACT_UNIX_SOCKET, 25 char *path); 26 ~~~ 27 28 # DESCRIPTION 29 30 Enables the use of an abstract Unix domain socket instead of establishing a 31 TCP connection to a host. The parameter should be a char * to a 32 null-terminated string holding the path of the socket. The path is set to 33 *path* prefixed by a NULL byte. This is the convention for abstract 34 sockets, however it should be stressed that the path passed to this function 35 should not contain a leading NULL byte. 36 37 On non-supporting platforms, the abstract address is interpreted as an empty 38 string and fails gracefully, generating a runtime error. 39 40 This option shares the same semantics as CURLOPT_UNIX_SOCKET_PATH(3) in 41 which documentation more details can be found. Internally, these two options 42 share the same storage and therefore only one of them can be set per handle. 43 44 # DEFAULT 45 46 NULL 47 48 # %PROTOCOLS% 49 50 # EXAMPLE 51 52 ~~~c 53 int main(void) 54 { 55 CURL *curl = curl_easy_init(); 56 if(curl) { 57 curl_easy_setopt(curl, CURLOPT_ABSTRACT_UNIX_SOCKET, "/tmp/foo.sock"); 58 curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/"); 59 60 /* Perform the request */ 61 curl_easy_perform(curl); 62 } 63 } 64 ~~~ 65 66 # %AVAILABILITY% 67 68 # RETURN VALUE 69 70 curl_easy_setopt(3) returns a CURLcode indicating success or error. 71 72 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 73 libcurl-errors(3).