---
title: "Communicator"
url: https://docs.zeroc.com/ice/3.8/runtime/communicator
language: matlab
docs_index: https://docs.zeroc.com/llms.txt
---

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

# Communicator

Programming language: MATLAB. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/communicator/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/communicator/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/communicator/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/communicator/js.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/communicator/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/communicator/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/communicator/ruby.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/communicator/swift.md).

A communicator is the entry point into the Ice runtime. You create proxies with a communicator, and each communicator has its own:

- **Outgoing connections** The communicator establishes and caches the connections that invocations on its proxies use.
- **Client-side thread pool** This [thread pool](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md) processes the messages received on the outgoing connections.
- **Object adapters** The communicator creates the [object adapters](https://docs.zeroc.com/ice/3.8/runtime/dispatch.md) that dispatch incoming requests to your servants.
- **Properties** Each communicator holds a [property set](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/matlab.md). These properties configure this communicator, and an Ice service or an application that uses this communicator can read its own properties from the same set.
- **Logger** The [logger](https://docs.zeroc.com/ice/3.8/administration/logger-facility/matlab.md) of a communicator receives the log messages of the Ice runtime.

Most applications use a single communicator, but an application can create several communicators when needed.

## Creating a Communicator

You create a communicator with the `Ice.Communicator` constructor:

```matlab
communicator = Ice.Communicator(args);
```

The constructor takes the command-line arguments and [sets a property](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/setting-properties-on-the-command-line.md) for each argument that names an Ice property. The constructor also accepts the `Properties` and `SliceLoader` name-value arguments; when you pass both the command-line arguments and `Properties`, the properties set by the arguments override those in `Properties`.

The constructor leaves `args` unchanged. To get the remaining arguments, create the properties yourself and pass them to the constructor:

```matlab
[props, remArgs] = Ice.Properties(args);
communicator = Ice.Communicator(Properties = props);
```

To destroy the communicator when the function that created it returns, schedule the call to `destroy` with `onCleanup`:

```matlab
cleanup = onCleanup(@() communicator.destroy());
```

MATLAB clears `cleanup` when the function returns, which calls `destroy` on the communicator.

## Destroying a Communicator

Destroy a communicator when you no longer need it. Destroying a communicator closes its connections and releases its resources.

## See Also

- [Setting Properties on the Command Line](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/setting-properties-on-the-command-line.md)
- [The Properties Class](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/properties-class/matlab.md)
