Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 131bc6c

Browse files
Add documentation for using Unix domain sockets. (yhirose#1954)
* Add documentation for using unix domain sockets. * Formatting
1 parent 10d68cf commit 131bc6c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,23 @@ Use `poll` instead of `select`
843843
844844
`select` system call is used as default since it's more widely supported. If you want to let cpp-httplib use `poll` instead, you can do so with `CPPHTTPLIB_USE_POLL`.
845845
846+
Unix Domain Socket Support
847+
--------------------------
848+
849+
Unix Domain Socket support is available on Linux and macOS.
850+
851+
```c++
852+
// Server
853+
httplib::Server svr("./my-socket.sock");
854+
svr.set_address_family(AF_UNIX).listen("./my-socket.sock", 80);
855+
856+
// Client
857+
httplib::Client cli("./my-socket.sock");
858+
cli.set_address_family(AF_UNIX);
859+
```
860+
861+
"my-socket.sock" can be a relative path or an absolute path. You application must have the appropriate permissions for the path. You can also use an abstract socket address on Linux. To use an abstract socket address, prepend a null byte ('\x00') to the path.
862+
846863

847864
Split httplib.h into .h and .cc
848865
-------------------------------

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /