Ejemplo n.º 1
0
        /// <summary>
        /// 监听IPC信道
        /// </summary>
        /// <param name="channelName">信道名称</param>
        /// <param name="protName">端口名称</param>
        public void ListenIPCChannel(string channelName, FormatterSinkProviderType fspt = FormatterSinkProviderType.Binary)
        {
            IDictionary props = new Hashtable();

            props["name"] = channelName;
            IClientChannelSinkProvider cckp = sinkBinaryProvider;

            if (fspt == FormatterSinkProviderType.Soap)
            {
                cckp = sinkSoapProvider;
            }
            IpcClientChannel channel = new IpcClientChannel(props, cckp);

            ChannelServices.RegisterChannel(channel, false);
            ipcChannels.Add(channelName);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 监听Http信道
        /// </summary>
        /// <param name="port">端口</param>
        /// <param name="channelName">信道名称</param>
        public void ListenHttpChannel(int port, string channelName, FormatterSinkProviderType fspt = FormatterSinkProviderType.Binary)
        {
            IDictionary props = new Hashtable();

            props["port"] = port;
            props["name"] = channelName;
            IServerChannelSinkProvider sckp = sinkBinaryProvider;

            if (fspt == FormatterSinkProviderType.Soap)
            {
                sckp = sinkSoapProvider;
            }
            HttpServerChannel srvChannel = new HttpServerChannel(props, sckp);

            ChannelServices.RegisterChannel(srvChannel, false);
            httpChannels.Add(channelName);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 监听IPC信道
        /// </summary>
        /// <param name="channelName">信道名称</param>
        /// <param name="protName">端口名称</param>
        public void ListenIPCChannel(string channelName, string protName, FormatterSinkProviderType fspt = FormatterSinkProviderType.Binary)
        {
            IDictionary props = new Hashtable();

            props["name"]            = channelName;
            props["portName"]        = protName;
            props["authorizedGroup"] = "Everyone";
            IServerChannelSinkProvider sckp = sinkBinaryProvider;

            if (fspt == FormatterSinkProviderType.Soap)
            {
                sckp = sinkSoapProvider;
            }
            IpcServerChannel channel = new IpcServerChannel(props, sckp);

            ChannelServices.RegisterChannel(channel, false);
            ipcChannels.Add(channelName);
        }