Skip to main content
Skip table of contents

Communicator Initialization and Destruction

Creating a Communicator

You create a communicator by using its constructor, for example:

C#
await using var communicator = new Ice.Communicator(ref args);

Ice.Communicator constructor accepts the argument vector that is passed to Main by the operating system. The method scans the argument vector for any command-line options that are relevant to the Ice runtime; any such options are removed from the argument vector so, when Ice.Communicator constructor returns, the only options and arguments remaining are those that concern your application. If anything goes wrong during initialization, it throws an exception.

Ice.Communicator provides additional constructors to pass other information to the Ice runtime.

Ice.Communicator implements both IDisposable and IAsyncDisposable. This allows you to create and cleanup your communicator with await using in async applications (as shown above). In synchronous code, you can use instead:

C#
// In synchronous code.
using var communicator = new Ice.Communicator(ref args);

Initialization Data

When a communicator is created, its constructor or the initialize method configures several features that control its behavior. Once set, these features remain in effect for the lifetime of the communicator and cannot be changed afterward. Therefore, any customization of these features must be done at communicator creation time.

The InitializationData class or struct holds all the features (or options) that you can customize when you create a communicator.

See Also
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.