diff options
author | juhlig <[email protected]> | 2019-05-21 09:21:34 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-05-22 13:53:43 +0200 |
commit | 5fe188abc31eae9a516c71dee61fa51633378c5c (patch) | |
tree | d8bdf571948f221b7729db2212ede660f4e1a6e8 /doc/src/guide | |
parent | 95b53ec7247ad68ed4cb2425b396377312ea3dee (diff) | |
download | ranch-5fe188abc31eae9a516c71dee61fa51633378c5c.tar.gz ranch-5fe188abc31eae9a516c71dee61fa51633378c5c.tar.bz2 ranch-5fe188abc31eae9a516c71dee61fa51633378c5c.zip |
Add docs for local sockets
Diffstat (limited to 'doc/src/guide')
-rw-r--r-- | doc/src/guide/listeners.asciidoc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/src/guide/listeners.asciidoc b/doc/src/guide/listeners.asciidoc index 24fb455..94552ba 100644 --- a/doc/src/guide/listeners.asciidoc +++ b/doc/src/guide/listeners.asciidoc @@ -160,6 +160,23 @@ We recommend the use of port rewriting for systems with a single server, and load balancing for systems with multiple servers. Documenting these solutions is however out of the scope of this guide. +=== Listening on a UNIX Domain socket + +On UNIX systems, it is also possible to use Ranch to listen on a UNIX +domain socket by specifying `{local, SocketFile}` for the `ip` socket +option. In this case, the port must be set to 0 or omitted. The given +file must not exist: Ranch must be able to create it. + +.Starting a listener for TCP connections on a UNIX Domain socket + +[source,erlang] +{ok, _} = ranch:start_listener(tcp_echo, + ranch_tcp, #{socket_opts => [ + {ip, {local, "/tmp/ranch_echo.sock"}}, + {port, 0} + ]}, echo_protocol, [] +). + === Accepting connections on an existing socket If you want to accept connections on an existing socket, you can write |