get_port(Ref :: ranch:ref()) -> Port :: inet:port_number() | undefined
ranch:get_port - Get the listening port
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.
The listener name.
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.
Port = ranch:get_port(example).
ranch:start_listener(3), ranch:get_addr(3), ranch:info(3), ranch(3)
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.