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/manual/ranch.get_addr.asciidoc | |
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/manual/ranch.get_addr.asciidoc')
-rw-r--r-- | doc/src/manual/ranch.get_addr.asciidoc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/doc/src/manual/ranch.get_addr.asciidoc b/doc/src/manual/ranch.get_addr.asciidoc index 3938347..7c48b3c 100644 --- a/doc/src/manual/ranch.get_addr.asciidoc +++ b/doc/src/manual/ranch.get_addr.asciidoc @@ -2,7 +2,7 @@ == Name -ranch:get_addr - Get the listening port and IP +ranch:get_addr - Get the listening address == Description @@ -11,9 +11,11 @@ ranch:get_addr - Get the listening port and IP get_addr(Ref :: ranch:ref()) -> {IP :: inet:ip_address(), Port :: inet:port_number()} + | {local, SocketFile :: binary()} + | {undefined, undefined} ---- -Get the listening port and IP. +Get the listening address. == Arguments @@ -23,11 +25,18 @@ The listener name. == Return value -The address of the listener is returned as a tuple. +The address of the listener is returned as a tuple of the form +`{IP, Port}` when listening on a network interface, or +`{local, SocketFile}` when listening on a UNIX Domain socket. +When the listener is suspended, `{undefined, undefined}` will +be returned. The IP address is the IP of the network interface the socket is bound to. +The socket file is the path of a file on your system the +socket is bound to. + == Examples .Get the listening port and IP @@ -36,6 +45,12 @@ socket is bound to. {IP, Port} = ranch:get_addr(example). ---- +.Get the listening UNIX Domain socket file +[source,erlang] +---- +{local, SocketFile} = ranch:get_addr(example). +---- + == See also link:man:ranch:start_listener(3)[ranch:start_listener(3)], |