Initialize() { bool ipv4 = (_communicator.GetPropertyAsInt("Ice.IPv4") ?? 1) > 0; bool preferIPv6 = _communicator.GetPropertyAsInt("Ice.PreferIPv6Address") > 0; string address; if (ipv4 && !preferIPv6) { address = _communicator.GetProperty($"{_name}.Address") ?? "239.255.0.1"; } else { address = _communicator.GetProperty($"{_name}.Address") ?? "ff15::1"; } int port = _communicator.GetPropertyAsInt($"{_name}.Port") ?? 4061; string intf = _communicator.GetProperty($"{_name}.Interface") ?? ""; string lookupEndpoints = _communicator.GetProperty($"{_name}.Lookup") ?? ""; if (lookupEndpoints.Length == 0) { int ipVersion = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6; List <string> interfaces = IceInternal.Network.GetInterfacesForMulticast(intf, ipVersion); foreach (string p in interfaces) { if (p != interfaces[0]) { lookupEndpoints += ":"; } lookupEndpoints += "udp -h \"" + address + "\" -p " + port + " --interface \"" + p + "\""; } } if (_communicator.GetProperty($"{_name}.Reply.Endpoints") == null) { _communicator.SetProperty($"{_name}.Reply.Endpoints", intf.Length == 0 ? "udp -h *" : $"udp -h \"{intf}\""); } if (_communicator.GetProperty($"{_name}.Locator.Endpoints") == null) { _communicator.SetProperty($"{_name}.Locator.AdapterId", Guid.NewGuid().ToString()); } _replyAdapter = _communicator.CreateObjectAdapter(_name + ".Reply"); _locatorAdapter = _communicator.CreateObjectAdapter(_name + ".Locator"); // We don't want those adapters to be registered with the locator so clear their locator. _replyAdapter.Locator = null; _locatorAdapter.Locator = null; var lookupPrx = ILookupPrx.Parse($"IceLocatorDiscovery/Lookup -d:{lookupEndpoints}", _communicator); // No colloc optimization or router for the multicast proxy! lookupPrx = lookupPrx.Clone(clearRouter: false, collocationOptimized: false); ILocatorPrx voidLo = _locatorAdapter.AddWithUUID(new VoidLocatorI(), ILocatorPrx.Factory); string instanceName = _communicator.GetProperty($"{_name}.InstanceName") ?? ""; var id = new Identity("Locator", instanceName.Length > 0 ? instanceName : Guid.NewGuid().ToString()); _defaultLocator = _communicator.GetDefaultLocator(); _locator = new LocatorI(_name, lookupPrx, _communicator, instanceName, voidLo); _locatorPrx = _locatorAdapter.AddWithUUID(_locator, ILocatorPrx.Factory); _communicator.SetDefaultLocator(_locatorPrx); ILookupReply lookupReplyI = new LookupReplyI(_locator); _locator.SetLookupReply(_replyAdapter.AddWithUUID(lookupReplyI, ILookupReplyPrx.Factory) .Clone(invocationMode: InvocationMode.Datagram)); _replyAdapter.Activate(); _locatorAdapter.Activate(); }