---
title: "IceLocatorDiscovery"
url: https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# IceLocatorDiscovery

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/php.md), [Python](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/plugins/icelocatordiscovery/swift.md).

## IceLocatorDiscovery Overview

IceLocatorDiscovery is an Ice plug-in that discovers a [locator](https://docs.zeroc.com/ice/3.8/runtime/locators.md) on the local network with UDP multicast. An application that installs it resolves its indirect proxies through the discovered locator, without setting `Ice.Default.Locator`.

IceGrid registries answer the plug-in's queries, so an application can use the plug-in to find an IceGrid deployment, including a [replicated deployment](https://docs.zeroc.com/ice/3.8/services/icegrid/registry-replication.md).

IceLocatorDiscovery relies on a location service, such as IceGrid, that runs on your network. The [IceDiscovery](https://docs.zeroc.com/ice/3.8/plugins/icediscovery.md) plug-in provides a location service with no additional process to run.

## Installing IceLocatorDiscovery

Install the plug-in in each communicator that discovers its default locator.

> **C++**
>
> When you write a client, you should install `IceLocatorDiscovery` in your communicator using the `pluginFactories` field of `InitializationData`:
>
> ```cpp
> #include <IceLocatorDiscovery/IceLocatorDiscovery.h>
>
> Ice::InitializationData initData;
> initData.properties = Ice::createProperties(argc, argv);
> initData.pluginFactories = {IceLocatorDiscovery::locatorDiscoveryPluginFactory()};
>
> Ice::CommunicatorPtr communicator = Ice::initialize(initData);
> ```
>
> Alternatively, you can install the IceLocatorDiscovery plug-in at runtime using configuration:
>
> ```config
> Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery
> ```
>
> When you use `pluginFactories`, link your application with the IceLocatorDiscovery library.
>
> > **Note**
> >
> > The static Ice library registers only the TCP and SSL transports by default. When you link with this library, also add `Ice::udpPluginFactory()` to `pluginFactories`.

> **C#**
>
> When you write a client, you should install `IceLocatorDiscovery` in your communicator using the `pluginFactories` field of `InitializationData`:
>
> ```csharp
> var initData = new Ice.InitializationData
> {
>     properties = new Ice.Properties(ref args),
>     pluginFactories = [new IceLocatorDiscovery.PluginFactory()]
> };
>
> await using Ice.Communicator communicator = Ice.Util.initialize(initData);
> ```
>
> Alternatively, you can install the IceLocatorDiscovery plug-in at runtime using configuration:
>
> ```config
> Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory
> ```

> **Java**
>
> When you write a client, you should install `IceLocatorDiscovery` in your communicator using the `pluginFactories` field of `InitializationData`:
>
> ```java
> InitializationData initData = new InitializationData();
> initData.properties = new com.zeroc.Ice.Properties(args);
> initData.pluginFactories =
>     java.util.List.of(new com.zeroc.IceLocatorDiscovery.PluginFactory());
>
> try (Communicator communicator = new Communicator(initData)) {
>     // Use the communicator.
> }
> ```
>
> Alternatively, you can install the IceLocatorDiscovery plug-in at runtime using configuration:
>
> ```config
> Ice.Plugin.IceLocatorDiscovery=com.zeroc.IceLocatorDiscovery.PluginFactory
> ```

> **JavaScript**
>
> > **Note**
> >
> > JavaScript does not support this plug-in or UDP multicast discovery.

> **MATLAB, PHP, Python, Ruby, and Swift**
>
> This mapping includes the IceLocatorDiscovery factory. Enable it with:
>
> ```config
> Ice.Plugin.IceLocatorDiscovery=1
> ```

## Configuring IceLocatorDiscovery

Applications configure IceLocatorDiscovery with properties. Do not set `Ice.Default.Locator` in an application that installs the plug-in.

The IceGrid node that starts a server configures its locator: the node sets `Ice.Default.Locator` or, when the node itself uses IceLocatorDiscovery, installs the plug-in in the server. Do not install the plug-in in the descriptor of a deployed server.

### IceLocatorDiscovery Property Overview

The plug-in and the IceGrid registry have the same default multicast address and port, so the plug-in works without any configuration when the registry keeps these defaults.

The main properties are:

- [IceLocatorDiscovery.InstanceName](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md#icelocatordiscovery.instancename) selects the IceGrid deployment with this instance name. When this property is unset, the plug-in keeps the instance name of the first locator it discovers.
- [IceLocatorDiscovery.Address](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md#icelocatordiscovery.address) and [IceLocatorDiscovery.Port](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md#icelocatordiscovery.port) set the multicast address and port of the queries. They must match the registry's [IceGrid.Registry.Discovery.Address](https://docs.zeroc.com/ice/3.8/property-reference/icegrid-properties.md#icegrid.registry.discovery.address) and [IceGrid.Registry.Discovery.Port](https://docs.zeroc.com/ice/3.8/property-reference/icegrid-properties.md#icegrid.registry.discovery.port).
- [IceLocatorDiscovery.Interface](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md#icelocatordiscovery.interface) restricts the queries to one network interface. By default, the plug-in sends its queries on all interfaces.

For example, to use a different multicast address and port:

```config
IceLocatorDiscovery.Address=239.255.0.99
IceLocatorDiscovery.Port=8000
```

See [IceLocatorDiscovery Properties](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md) for the complete list.

### IceGrid Registries and Administrative Tools

IceGrid registries answer multicast discovery queries unless you set [IceGrid.Registry.Discovery.Enabled](https://docs.zeroc.com/ice/3.8/property-reference/icegrid-properties.md#icegrid.registry.discovery.enabled) to `0`, and [IceGrid.Registry.Discovery.Interface](https://docs.zeroc.com/ice/3.8/property-reference/icegrid-properties.md#icegrid.registry.discovery.interface) restricts a registry to one network interface.

The [command-line](https://docs.zeroc.com/ice/3.8/services/icegrid/icegridadmin-command-line-tool.md) and [graphical](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-gui-tool.md) IceGrid administrative tools discover the registries on the network and let you choose one. They read `IceLocatorDiscovery.Address`, `IceLocatorDiscovery.Port` and `IceLocatorDiscovery.Interface` for their multicast settings.

### IceGrid Nodes and Slave Registries

You can also use the plug-in inside an IceGrid deployment, to simplify the configuration of its nodes and slave registries: a node discovers its registry, and a slave registry discovers the master registry, without `Ice.Default.Locator`. Install the plug-in in the configuration file of the node or slave registry, and set [IceLocatorDiscovery.InstanceName](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md#icelocatordiscovery.instancename) to the instance name of the deployment:

```config
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery
IceLocatorDiscovery.InstanceName=IceGrid
```

## See Also

- [IceLocatorDiscovery Properties](https://docs.zeroc.com/ice/3.8/property-reference/icelocatordiscovery-properties.md)
- [Registry Replication](https://docs.zeroc.com/ice/3.8/services/icegrid/registry-replication.md)
- [Plug-in Facility](https://docs.zeroc.com/ice/3.8/plugins/plug-in-facility.md)
