Packages

EpmdUp: A simple Elixir module to check and manage the Erlang Port Mapper Daemon (epmd).

Current section

Files

Jump to
epmd_up lib epmd_up.ex
Raw

lib/epmd_up.ex

defmodule EpmdUp do
@moduledoc """
Documentation for `EpmdUp`.
"""
require Logger
@doc """
Checks if the Erlang Port Mapper Daemon (`epmd`) is active and accepting connections.
This function attempts to establish a TCP connection to the `epmd` port (4369) on localhost.
If the connection is successful, it means `epmd` is running and accepting connections.
## Returns
* `true` - if `epmd` is active and accepting connections
* `false` - if `epmd` is not running or not accepting connections
"""
@spec active?() :: boolean()
def active? do
case :net_adm.names() do
{:ok, _} -> true
{:error, _} -> false
end
end
end