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