blob: 5c5563ee058d846374743b4d61b5b9aeb2d8b9b8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
= ranch:get_port(3)
== Name
ranch:get_port - Get the listening port
== Description
[source,erlang]
----
get_port(Ref :: ranch:ref())
-> Port :: inet:port_number() | undefined
----
Get the listening port.
This function is particularly useful to retrieve the
listening port number when it was not provided in the
options and was chosen randomly instead.
== Arguments
Ref::
The listener name.
== Return value
The listening port is returned.
When the listener is suspended or using a UNIX Domain
socket instead of a network interface, `undefined`
will be returned.
== Examples
.Get the listening port
[source,erlang]
----
Port = ranch:get_port(example).
----
== See also
link:man:ranch:start_listener(3)[ranch:start_listener(3)],
link:man:ranch:get_addr(3)[ranch:get_addr(3)],
link:man:ranch:info(3)[ranch:info(3)],
link:man:ranch(3)[ranch(3)]
|