# Class OtpEpmd

java.lang.Object
com.ericsson.otp.erlang.OtpEpmd

public class OtpEpmd extends Object
Provides methods for registering, unregistering and looking up nodes with the Erlang portmapper daemon (Epmd). For each registered node, Epmd maintains information about the port on which incoming connections are accepted, as well as which versions of the Erlang communication protocol the node supports.

Nodes wishing to contact other nodes must first request information from Epmd before a connection can be set up, however this is done automatically by `OtpSelf.connect()` when necessary.

The methods `publishPort()` and `unPublishPort()` will fail if an Epmd process is not running on the localhost. Additionally `lookupPort()` will fail if there is no Epmd process running on the host where the specified node is running. See the Erlang documentation for information about starting Epmd.

This class contains only static methods, there are no constructors.

## Method Summary

Modifier and Type
Method
Description
`static String[]`
`lookupNames()`
`static String[]`
`lookupNames(OtpTransportFactory transportFactory)`
`static String[]`
`lookupNames(InetAddress address)`
`static String[]`
`lookupNames(InetAddress address, OtpTransportFactory transportFactory)`
`static int`
`lookupPort(AbstractNode node)`
Determine what port a node listens for incoming connections on.
`static boolean`
`publishPort(OtpLocalNode node)`
Register with Epmd, so that other nodes are able to find and connect to it.
`static void`
`unPublishPort(OtpLocalNode node)`
Unregister from Epmd.
`static void`
`useEpmdPort(int port)`
Set the port number to be used to contact the epmd process.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### useEpmdPort

public static void useEpmdPort(int port)
Set the port number to be used to contact the epmd process. Only needed when the default port is not desired and system environment variable ERL_EPMD_PORT cannot be read (applet).

### lookupPort

public static int lookupPort(AbstractNode node) throws IOException
Determine what port a node listens for incoming connections on.

Returns:
  the listen port for the specified node, or 0 if the node was not registered with Epmd.
Throws:
  `IOException` - if there was no response from the name server.

### publishPort

public static boolean publishPort(OtpLocalNode node) throws IOException
Register with Epmd, so that other nodes are able to find and connect to it.

Parameters:
  `node` - the server node that should be registered with Epmd.
Returns:
  true if the operation was successful. False if the node was already registered.
Throws:
  `IOException` - if there was no response from the name server.

### unPublishPort

public static void unPublishPort(OtpLocalNode node)
Unregister from Epmd. Other nodes wishing to connect will no longer be able to.

This method does not report any failures.

### lookupNames

public static String[] lookupNames() throws IOException

Throws:
  `IOException`

### lookupNames

public static String[] lookupNames(OtpTransportFactory transportFactory) throws IOException

Throws:
  `IOException`

### lookupNames

public static String[] lookupNames(InetAddress address) throws IOException

Throws:
  `IOException`

### lookupNames

public static String[] lookupNames(InetAddress address, OtpTransportFactory transportFactory) throws IOException

Throws:
  `IOException`