• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Ipc.IpcClientChannel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Runtime.Remoting.Channels.Ipc.IpcClientChannel的典型用法代码示例。如果您正苦于以下问题:C# IpcClientChannel类的具体用法?C# IpcClientChannel怎么用?C# IpcClientChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IpcClientChannel类属于System.Runtime.Remoting.Channels.Ipc命名空间,在下文中一共展示了IpcClientChannel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Start

        /// <summary>
        /// Start connection with specified engine interface
        /// </summary>
        /// <param name="typeEngineInterface">Type of engine interface</param>
        /// <param name="urlClient">Asscoiated URL</param>
        /// <param name="ensureSecurity">Remoting security attribute</param>
        public void Start(string urlClient, bool ensureSecurity, uint timeOut, Type iProxyType)
        {
            Trace.TraceInformation("Configuring client connection");

            _ensureSecurity = ensureSecurity;

            #if MONO
            _sinkProvider = new BinaryClientFormatterSinkProvider();
            #endif

            IDictionary t = new Hashtable();
            t.Add("timeout", timeOut);
            t.Add("name", urlClient);

            Console.WriteLine("New IPC channel");

            // need to make ChannelNames unique so need to use this
            // constructor even though we dont care about the sink provider
            _channel = new IpcClientChannel(urlClient, _sinkProvider);

            Console.WriteLine("\tRegister");

            ChannelServices.RegisterChannel(_channel, _ensureSecurity);

            Console.WriteLine("\tActivate object proxy to IEngine");

            _base = (IBase)Activator.GetObject(iProxyType, urlClient);

            Console.WriteLine("\tActivated.");
        }
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:36,代码来源:RemotingConnectionIpc.cs


示例2: VisualStudioInstance

        public VisualStudioInstance(Process process, DTE dte)
        {
            _hostProcess = process;
            _dte = dte;

            dte.ExecuteCommandAsync(VisualStudioCommandNames.VsStartServiceCommand).GetAwaiter().GetResult();

            _integrationServiceChannel = new IpcClientChannel($"IPC channel client for {_hostProcess.Id}", sinkProvider: null);
            ChannelServices.RegisterChannel(_integrationServiceChannel, ensureSecurity: true);

            // Connect to a 'well defined, shouldn't conflict' IPC channel
            var serviceUri = string.Format($"ipc://{IntegrationService.PortNameFormatString}", _hostProcess.Id);
            _integrationService = (IntegrationService)(Activator.GetObject(typeof(IntegrationService), $"{serviceUri}/{typeof(IntegrationService).FullName}"));
            _integrationService.Uri = serviceUri;

            // There is a lot of VS initialization code that goes on, so we want to wait for that to 'settle' before
            // we start executing any actual code.
            _integrationService.Execute(typeof(RemotingHelper), nameof(RemotingHelper.WaitForSystemIdle));

            _csharpInteractiveWindow = new Lazy<CSharpInteractiveWindow>(() => new CSharpInteractiveWindow(this));
            _editorWindow = new Lazy<EditorWindow>(() => new EditorWindow(this));
            _solutionExplorer = new Lazy<SolutionExplorer>(() => new SolutionExplorer(this));
            _workspace = new Lazy<Workspace>(() => new Workspace(this));

            // Ensure we are in a known 'good' state by cleaning up anything changed by the previous instance
            Cleanup();
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:27,代码来源:VisualStudioInstance.cs


示例3: GetMessager

		/// <summary>
		/// Gets an instance of a <see cref="Messager"/> to use to talk to the running instance of the client.
		/// </summary>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_gmdGameModeInfo">The descriptor of the game mode for which mods are being managed.</param>
		/// <returns>An instance of a <see cref="Messager"/> to use to talk to the running instance of the client,
		/// or <c>null</c> if no valid <see cref="Messager"/> could be created.</returns>
		public static IMessager GetMessager(EnvironmentInfo p_eifEnvironmentInfo, IGameModeDescriptor p_gmdGameModeInfo)
		{
			if (m_cchMessagerChannel == null)
			{
				System.Collections.IDictionary properties = new System.Collections.Hashtable();
				properties["exclusiveAddressUse"] = false;
				m_cchMessagerChannel = new IpcClientChannel();
				ChannelServices.RegisterChannel(m_cchMessagerChannel, true);
			}
			else
				throw new InvalidOperationException("The IPC Channel has already been created as a CLIENT.");

			string strMessagerUri = String.Format("ipc://{0}-{1}IpcServer/{1}Listener", p_eifEnvironmentInfo.Settings.ModManagerName, p_gmdGameModeInfo.ModeId);
			IMessager msgMessager = null;
			try
			{
				Trace.TraceInformation(String.Format("Getting listener on: {0}", strMessagerUri));
				msgMessager = (IMessager)Activator.GetObject(typeof(IMessager), strMessagerUri);

				//Just because a messager has been returned, dosn't mean it exists.
				//All you've really done at this point is create an object wrapper of type "Messager" which has the same methods, properties etc...
				//You wont know if you've got a real object, until you invoke something, hence the post (Power on self test) method.
				msgMessager.Post();
			}
			catch (RemotingException e)
			{
				Trace.TraceError("Could not get Messager: {0}", strMessagerUri);
				TraceUtil.TraceException(e);
				return null;
			}
			return new MessagerClient(msgMessager);
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:39,代码来源:MessagerClient.cs


示例4: PtAccClient

 /// <summary>
 /// Register remoting channel and types
 /// </summary>
 private PtAccClient()
 {
     IpcClientChannel clientChannel = new IpcClientChannel();
     ChannelServices.RegisterChannel(clientChannel, true);
     RemotingConfiguration.RegisterWellKnownClientType(typeof(PtAccRemoteType), "ipc://remote/PtAcc");
     _remoteType = new PtAccRemoteType();
 }
开发者ID:Raggles,项目名称:HC.PtAcc,代码行数:10,代码来源:PtAccClient.cs


示例5: Send

        public static void Send(Program.AppMessage msg, int lParam,
            bool bWaitWithTimeout)
        {
            if(!KeePassLib.Native.NativeLib.IsUnix()) // Windows
            {
                if(bWaitWithTimeout)
                {
                    IntPtr pResult = new IntPtr(0);
                    NativeMethods.SendMessageTimeout((IntPtr)NativeMethods.HWND_BROADCAST,
                        Program.ApplicationMessage, (IntPtr)msg,
                        (IntPtr)lParam, NativeMethods.SMTO_ABORTIFHUNG, 5000, ref pResult);
                }
                else
                    NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST,
                        Program.ApplicationMessage, (IntPtr)msg, (IntPtr)lParam);
            }
            else // Unix
            {
                if(m_chClient == null)
                {
                    m_chClient = new IpcClientChannel();
                    ChannelServices.RegisterChannel(m_chClient, false);
                }

                try
                {
                    IpcBroadcastSingleton ipc = (Activator.GetObject(typeof(
                        IpcBroadcastSingleton), "ipc://" + GetPortName() + "/" +
                        IpcObjectName) as IpcBroadcastSingleton);
                    if(ipc != null) ipc.Call((int)msg, lParam);
                }
                catch(Exception) { } // Server might not exist
            }
        }
开发者ID:elitak,项目名称:keepass,代码行数:34,代码来源:IpcBroadcast.cs


示例6: Main

		public static void Main (string [] args)
		{
			IpcClientChannel channel = new IpcClientChannel ();
			ChannelServices.RegisterChannel (channel, false);
			IFoo foo = (IFoo) Activator.GetObject (typeof (IFoo), "ipc://Foo/Foo");
			foo.Foo ();
		}
开发者ID:mono,项目名称:gert,代码行数:7,代码来源:client.cs


示例7: RegisterProxy

        /// <summary>
        /// Register the ipc client proxy
        /// </summary>
        internal void RegisterProxy()
        {
            try
            {
                string uri = "ipc://NetOffice.SampleChannel/NetOffice.WebTranslationService.DataService";

                //Create an IPC client channel.
                _channel = new IpcClientChannel();

                //Register the channel with ChannelServices.
                ChannelServices.RegisterChannel(_channel, true);

                //Register the client type.
                WellKnownClientTypeEntry[] entries = RemotingConfiguration.GetRegisteredWellKnownClientTypes();
                if (null == GetEntry(entries, uri))
                {
                    RemotingConfiguration.RegisterWellKnownClientType(
                                        typeof(WebTranslationService),
                                        uri);
                }
                DataService = new WebTranslationService();

                // try to do some action to see the server is alive
                string[] dumy = DataService.AvailableTranslations;
            }
            catch (RemotingException exception)
            {
                // rethrow the exception with a friendly message
                throw new RemotingException("Unable to connect the local translation service.", exception);
            }
            catch (Exception)
            {
                throw;
            }
        }
开发者ID:swatt6400,项目名称:NetOffice,代码行数:38,代码来源:TranslationClient.cs


示例8: Bug81653

		public void Bug81653 ()
		{
			IpcClientChannel c = new IpcClientChannel ();
			ChannelDataStore cd = new ChannelDataStore (new string[] { "foo" });
			string objectUri;
			c.CreateMessageSink (null, cd, out objectUri);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:IpcChannelTest.cs


示例9: MonitorVdmClient

 public MonitorVdmClient()
 {
     // Set up communication with the virtual desktop monitoring server.
     _channel = new IpcClientChannel();
     ChannelServices.RegisterChannel( _channel, false );
     _monitorVdm = (IMonitorVdmService)Activator.GetObject( typeof( IMonitorVdmService ), "ipc://VirtualDesktopManagerAPI/MonitorVdmService" );
 }
开发者ID:Whathecode,项目名称:ABC,代码行数:7,代码来源:MonitorVdmClient.cs


示例10: ChromePersistence

 public ChromePersistence()
     : base("chrome", "Google Inc.")
 {
     // Set up communication with the Chrome ABC extension.
     _channel = new IpcClientChannel();
     ChannelServices.RegisterChannel( _channel, false );
     _chromeService = (IChromeAbcService)Activator.GetObject( typeof( IChromeAbcService ), "ipc://ChromeAbcConnection/ChromeAbcService" );
 }
开发者ID:Whathecode,项目名称:ABC,代码行数:8,代码来源:ChromePersistence.cs


示例11: CreateClientChannel

        private static void CreateClientChannel(String arg)
        {
            IpcClientChannel channel = new IpcClientChannel();
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownClientType(typeof(Ipc), "ipc://" + ipcPortName + "/" + ipcServername);

            Ipc ipc = new Ipc();
            ipc.OpenFile(arg);
        }
开发者ID:Traderain,项目名称:coldemoplayer,代码行数:9,代码来源:Program.cs


示例12: Main

        static void Main(string[] args)
        {
            if (args == null)
                throw new ArgumentNullException("args");

            if (args.Length != 1)
                throw new ArgumentException("Arguments number doesn't match!", "args");

            var name = args[0];

            if (string.IsNullOrEmpty(name))
                throw new Exception("Name cannot be null or empty.");

            name = name.Trim('"');

            var channelPort = string.Format(ProcessAppConst.PortNameTemplate, name, Process.GetCurrentProcess().Id);

            var currentDomain = AppDomain.CurrentDomain;
            var root = Path.Combine(Path.Combine(currentDomain.BaseDirectory, ProcessAppConst.WorkingDir), name);

            //Hack to change the default AppDomain's root
            if (NDockEnv.IsMono) //for Mono
            {
                var pro = typeof(AppDomain).GetProperty("SetupInformationNoCopy", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty);
                var setupInfo = (AppDomainSetup)pro.GetValue(currentDomain, null);
                setupInfo.ApplicationBase = root;
            }
            else // for .NET
            {
                currentDomain.SetData("APPBASE", root);
            }

            currentDomain.SetData(typeof(IsolationMode).Name, IsolationMode.Process);

            try
            {
                var serverChannel = new IpcServerChannel("IpcAgent", channelPort, new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full });
                var clientChannel = new IpcClientChannel();
                ChannelServices.RegisterChannel(serverChannel, false);
                ChannelServices.RegisterChannel(clientChannel, false);
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(ManagedAppWorker), ProcessAppConst.WorkerRemoteName, WellKnownObjectMode.Singleton);

                Console.WriteLine("Ok");

                var line = Console.ReadLine();

                while (!"quit".Equals(line, StringComparison.OrdinalIgnoreCase))
                {
                    line = Console.ReadLine();
                }
            }
            catch
            {
                Console.Write("Failed");
            }
        }
开发者ID:huoxudong125,项目名称:NDock,代码行数:56,代码来源:Program.cs


示例13: Sounds

        static Sounds()
        {
            //クライアントのチャンネルを生成
            IpcClientChannel channel = new IpcClientChannel();
            //チャンネルを登録
            ChannelServices.RegisterChannel(channel, true);

            //リモートオブジェクトの取得
            midObject = Activator.GetObject(typeof(IPCSound), "ipc://HoppoAlphaSound/SoundData") as IPCSound;
        }
开发者ID:CoRelaxuma,项目名称:HoppoAlpha,代码行数:10,代码来源:Sounds.cs


示例14: IpcClient

        /// <summary>
        /// コンストラクタ
        /// </summary>
        public IpcClient()
        {
            // クライアントチャンネルの生成
            IpcClientChannel channel = new IpcClientChannel();

            // チャンネルを登録
            ChannelServices.RegisterChannel(channel, true);

            // リモートオブジェクトを取得
            RemoteObject = Activator.GetObject(typeof(IpcRemoteObj), "ipc://" + IpcRemoteObj.ipcAddr + "/" + IpcRemoteObj.ipcAddrCom) as IpcRemoteObj;
        }
开发者ID:terakenxx,项目名称:TukubaChallenge,代码行数:14,代码来源:IpcRemoteObj.cs


示例15: IpcClientTransportSink

 internal IpcClientTransportSink(string channelURI, IpcClientChannel channel)
 {
     string str;
     this.portCache = new ConnectionCache();
     this._tokenImpersonationLevel = TokenImpersonationLevel.Identification;
     this._timeout = 0x3e8;
     this._channel = channel;
     string str2 = IpcChannelHelper.ParseURL(channelURI, out str);
     int startIndex = str2.IndexOf("://") + 3;
     this._portName = str2.Substring(startIndex);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:IpcClientTransportSink.cs


示例16: Start

        public static void Start()
        {
#if !MULTI_START_DEBUG
            // ゾンビプロセスがいたら殺す
            var ps = Process.GetProcessesByName("ACT.TTSYukkuri.TTSServer");
            if (ps != null)
            {
                foreach (var p in ps)
                {
                    p.Kill();
                    p.Dispose();
                }
            }

            var pi = new ProcessStartInfo(ServerProcessPath)
            {
                CreateNoWindow = true,
                UseShellExecute = false,
                WindowStyle = ProcessWindowStyle.Hidden,
            };

            ServerProcess = Process.Start(pi);
#endif
            channel = new IpcClientChannel();
            ChannelServices.RegisterChannel(channel, true);

            Message = (TTSMessage)Activator.GetObject(typeof(TTSMessage), "ipc://TTSYukkuriChannel/message");

            // 通信の確立を待つ
            // 200ms x 150 = 30s
            var ready = false;
            var retryCount = 0;
            while (!ready)
            {
                try
                {
                    Thread.Sleep(200);
                    ready = Message.IsReady();
                }
                catch (Exception ex)
                {
                    retryCount++;

                    if (retryCount >= 150)
                    {
                        Message = null;
                        throw new Exception(
                            "TT制御プロセスへの接続がタイムアウトしました。",
                            ex);
                    }
                }
            }
        }
开发者ID:kinokonoyama,项目名称:ACT.TTSYukkuri,代码行数:53,代码来源:TTSServerController.cs


示例17: ProcessBootstrap

        static ProcessBootstrap()
        {
            // Create the channel.
            var clientChannel = new IpcClientChannel();
            // Register the channel.
            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(clientChannel, false);

            var serverChannel = new IpcServerChannel("Bootstrap", BootstrapIpcPort);
            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(serverChannel, false);

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(ProcessBootstrapProxy), "Bootstrap.rem", WellKnownObjectMode.Singleton);
        }
开发者ID:hjlfmy,项目名称:SuperSocket,代码行数:12,代码来源:ProcessBootstrap.cs


示例18: Main

        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        static void Main(string[] args)
        {
            if (args == null)
                throw new ArgumentNullException("args");

            if(args.Length != 3)
                throw new ArgumentException("Arguments number doesn't match!", "args");

            var name = args[0];

            if(string.IsNullOrEmpty(name))
                throw new Exception("Name cannot be null or empty.");

            name = name.Trim('"');

            var channelPort = args[1];

            if (string.IsNullOrEmpty(channelPort))
                throw new Exception("Channel port cannot be null or empty.");

            channelPort = channelPort.Trim('"');
            channelPort = string.Format(channelPort, Process.GetCurrentProcess().Id);

            var root = args[2];

            if (string.IsNullOrEmpty(root))
                throw new Exception("Root cannot be null or empty.");

            AppDomain.CurrentDomain.SetData("APPBASE", root);
            AppDomain.CurrentDomain.SetData(typeof(IsolationMode).Name, IsolationMode.Process);

            try
            {
                var serverChannel = new IpcServerChannel("IpcAgent", channelPort);
                var clientChannel = new IpcClientChannel();
                ChannelServices.RegisterChannel(serverChannel, false);
                ChannelServices.RegisterChannel(clientChannel, false);
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(WorkItemAgent), "WorkItemAgent.rem", WellKnownObjectMode.Singleton);
                Console.WriteLine("Ok");

                var line = Console.ReadLine();

                while (!"quit".Equals(line, StringComparison.OrdinalIgnoreCase))
                {
                    line = Console.ReadLine();
                }
            }
            catch
            {
                Console.WriteLine("Failed");
            }
        }
开发者ID:baweiji,项目名称:SuperSocket,代码行数:56,代码来源:Program.cs


示例19: ProcessBootstrap

        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessBootstrap" /> class.
        /// </summary>
        /// <param name="config">The config.</param>
        public ProcessBootstrap(IConfigurationSource config)
            : base(config)
        {
            var clientChannel = ChannelServices.RegisteredChannels.FirstOrDefault(c => c is IpcClientChannel);

            if(clientChannel == null)
            {
                // Create the channel.
                clientChannel = new IpcClientChannel();
                // Register the channel.
                ChannelServices.RegisterChannel(clientChannel, false);
            }
        }
开发者ID:iraychen,项目名称:SuperSocket,代码行数:17,代码来源:ProcessBootstrap.cs


示例20: InitializeClient

 public static void InitializeClient(string objectUri, string portName, System.Type type)
 {
     if (_clientChannel != null) {
         Logger.Info("IpcHelper.InitializeClient chiude il canale aperto ...");
         ChannelServices.UnregisterChannel(_clientChannel);
     }
     Hashtable props = new Hashtable();
     props.Add("connectionTimeout", 100000);
     _clientChannel = new IpcClientChannel(props, null);
     ChannelServices.RegisterChannel(_clientChannel, true);
     RemotingConfiguration.RegisterWellKnownClientType(type, string.Format("ipc://{0}/{1}", portName, objectUri));
     Logger.Info("CacheClientHelper inizializzato");
 }
开发者ID:mariocosmi,项目名称:Worker,代码行数:13,代码来源:IpcHelper.cs



注:本文中的System.Runtime.Remoting.Channels.Ipc.IpcClientChannel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ipc.IpcServerChannel类代码示例发布时间:2022-05-26
下一篇:
C# Http.HttpChannel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap