Exemple #1
0
        internal static void InitializeClientChannel()
        {
            lock (s_lock)
            {
                if (CreatedInAD)                    // only one client channel per AD
                {
                    return;
                }
                CreatedInAD = true;                 // make sure this hasn't been created already in this AD

                //
                BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
                serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
                System.Collections.IDictionary    props          = new System.Collections.Hashtable();
                props["name"]            = "ClientChannel";
                props["portName"]        = Guid.NewGuid().ToString();
                props["typeFilterLevel"] = "Full";

                // When communicating between application domains on the same computer, the ipc channel is much faster than the tcp
                IChannel ichannel = new AddInIpcChannel(props, clientProvider, serverProvider);

                // (
                ChannelServices.RegisterChannel(ichannel, false);
            }
        }
        internal static void InitializeClientChannel()
        {
            lock(s_lock)
            {
                if (CreatedInAD)                    // only one client channel per AD
                    return;
                CreatedInAD = true;                 // make sure this hasn't been created already in this AD

                // 
                BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
                serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
                System.Collections.IDictionary props = new System.Collections.Hashtable();
                props["name"] = "ClientChannel";
                props["portName"] = Guid.NewGuid().ToString();
                props["typeFilterLevel"] = "Full";

                // When communicating between application domains on the same computer, the ipc channel is much faster than the tcp
                IChannel ichannel = new AddInIpcChannel(props, clientProvider, serverProvider);

                // (
                ChannelServices.RegisterChannel(ichannel, false);
            }
        }