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

C# Ipc.IpcServerChannel类代码示例

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

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



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

示例1: Main

		static void Main (string [] args)
		{
			IpcServerChannel channel = new IpcServerChannel ("Foo");
			ChannelServices.RegisterChannel (channel, false);
			RemotingConfiguration.RegisterWellKnownServiceType (typeof (Fooo), "Foo", WellKnownObjectMode.Singleton);
			Console.ReadLine ();
		}
开发者ID:mono,项目名称:gert,代码行数:7,代码来源:server.cs


示例2: Main

        static void Main(string[] args)
        {
            if ((args.Length == 2) && (args[0].Equals("-iphonepackager")))
            {
                // We were run as a 'child' process, quit when our 'parent' process exits
                // There is no parent-child relationship WRT windows, it's self-imposed.
                int ParentPID = int.Parse(args[1]);

                IpcServerChannel Channel = new IpcServerChannel("iPhonePackager");
                ChannelServices.RegisterChannel(Channel, false);
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentImplementation), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton);

                Process ParentProcess = Process.GetProcessById(ParentPID);
                while (!ParentProcess.HasExited)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            else
            {
                // Run directly by some intrepid explorer
                Console.WriteLine("Note: This program should only be started by iPhonePackager");
                Console.WriteLine("  This program cannot be used on it's own.");

                DeploymentImplementation Deployer = new DeploymentImplementation();
                var DeviceList = Deployer.EnumerateConnectedDevices();
                foreach (var Device in DeviceList)
                {
                    Console.WriteLine("  - Found device named {0} of type {1} with UDID {2}", Device.DeviceName, Device.DeviceType, Device.UDID);
                }

                Console.WriteLine("Exiting.");
            }
        }
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:34,代码来源:Program.cs


示例3: EntryPoint

        public EntryPoint(
            EasyHook.RemoteHooking.IContext context,
            String channelName,
            CaptureConfig config)
        {
            // Get reference to IPC to host application
            // Note: any methods called or events triggered against _interface will execute in the host process.
            _interface = EasyHook.RemoteHooking.IpcConnectClient<CaptureInterface>(channelName);

            // We try to ping immediately, if it fails then injection fails
            _interface.Ping();

            #region Allow client event handlers (bi-directional IPC)
            
            // Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly
            System.Collections.IDictionary properties = new System.Collections.Hashtable();
            properties["name"] = channelName;
            properties["portName"] = channelName + Guid.NewGuid().ToString("N"); // random portName so no conflict with existing channels of channelName

            System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider binaryProv = new System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider();
            binaryProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            System.Runtime.Remoting.Channels.Ipc.IpcServerChannel _clientServerChannel = new System.Runtime.Remoting.Channels.Ipc.IpcServerChannel(properties, binaryProv);
            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(_clientServerChannel, false);
            
            #endregion
        }
开发者ID:Csharper1972,项目名称:Direct3DHook,代码行数:27,代码来源:EntryPoint.cs


示例4: EyesarServer

 protected EyesarServer(EyesarSharedObject sharedObject)
 {
     if (ChannelServices.RegisteredChannels.Any(channel => channel.ChannelName == "Eyesar"))
         throw new InvalidOperationException();
     _channel = new IpcServerChannel("Eyesar", "eyesar");
     ChannelServices.RegisterChannel(_channel, false);
     RemotingServices.Marshal(SharedObject = sharedObject, "shared", typeof (EyesarSharedObject));
 }
开发者ID:theoxuan,项目名称:Remoting,代码行数:8,代码来源:EyesarServer.cs


示例5: PtAccServer

 public PtAccServer()
 {
     // Create and register an IPC channel
     serverChannel = new IpcServerChannel("remote");
     ChannelServices.RegisterChannel(serverChannel, true);
     // Expose an object
     RemotingConfiguration.RegisterWellKnownServiceType(typeof(PtAccRemoteType), "PtAcc", WellKnownObjectMode.Singleton);
 }
开发者ID:Raggles,项目名称:HC.PtAcc,代码行数:8,代码来源:PtAccServer.cs


示例6: RegisterIpcChannel

      public static void RegisterIpcChannel(EventHandler<NewInstanceDetectedEventArgs> handler)
      {
         IChannel ipcChannel = new IpcServerChannel(String.Format(CultureInfo.InvariantCulture, "hfm-{0}-{1}", Environment.UserName, AssemblyGuid));
         ChannelServices.RegisterChannel(ipcChannel, false);

         var obj = new IpcObject(handler);
         RemotingServices.Marshal(obj, ObjectName);
      }
开发者ID:harlam357,项目名称:hfm-net,代码行数:8,代码来源:SingleInstanceHelper.cs


示例7: Start

        public static Server Start(ApplicationCore applicationCore)
        {
            var serverChannel = new IpcServerChannel("SassTray");
            ChannelServices.RegisterChannel(serverChannel, true);
            var server = new Server(applicationCore);
            RemotingServices.Marshal(server, "Server", typeof(Server));

            return server;
        }
开发者ID:mayuki,项目名称:SassTray,代码行数:9,代码来源:Server.cs


示例8: StartServer

		static void StartServer(AssemblyService service, string name, string uri) {
			var props = new Hashtable();
			props["portName"] = name;
			var provider = new BinaryServerFormatterSinkProvider();
			provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
			var channel = new IpcServerChannel(props, provider);
			ChannelServices.RegisterChannel(channel, false);
			RemotingServices.Marshal(service, uri);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:9,代码来源:AssemblyServer.cs


示例9: 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


示例10: ListenForLaunches

        public void ListenForLaunches()
        {
            if (!IsFirstInstance)
            {
                throw new InvalidOperationException();
            }

            IpcServerChannel channel = new IpcServerChannel(ApplicationId);
            ChannelServices.RegisterChannel(channel, true);

            RemotingServices.Marshal(this, ApplicationId, typeof (IFirstInstanceServer));
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:12,代码来源:SingleInstanceManager.cs


示例11: 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


示例12: 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


示例13: _CreateRemoteService

        private static void _CreateRemoteService(string channelName)
        {
            _channel = new IpcServerChannel(
                new Dictionary<string, string>
                {
                    { "name", channelName },
                    { "portName", channelName },
                    { "exclusiveAddressUse", "false" },
                },
                new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full });

            ChannelServices.RegisterChannel(_channel, true);
            RemotingServices.Marshal(new _IpcRemoteService(), _RemoteServiceName);
        }
开发者ID:cstrahan,项目名称:openpos,代码行数:14,代码来源:SingleInstance.cs


示例14: RegisterRemoteType

        /// <summary>
        /// Registers the remote type.
        /// </summary>
        /// <param name="uri">The URI.</param>
        private static void RegisterRemoteType(string uri)
        {
            // register remote channel (net-pipes)
            var serverChannel = new IpcServerChannel(Environment.MachineName + uri);
            ChannelServices.RegisterChannel(serverChannel, true);

            // register shared type
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(InstanceProxy), uri, WellKnownObjectMode.Singleton);

            // close channel, on process exit
            Process process = Process.GetCurrentProcess();
            process.Exited += delegate { ChannelServices.UnregisterChannel(serverChannel); };
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:18,代码来源:ApplicationInstanceManager.cs


示例15: RegisterServer

        /// <summary>
        /// Register the Service Property as IPC Server
        /// </summary>
        private void RegisterServer()
        {
            Repeater = new DataEventRepeator();
            IpcServerChannel channel = new IpcServerChannel("NetOffice.SampleChannel");
            ChannelServices.RegisterChannel(channel, true);
            RemotingConfiguration.RegisterWellKnownServiceType(
                                        typeof(WebTranslationService),
                                        "NetOffice.WebTranslationService.DataService",
                                        WellKnownObjectMode.Singleton);

            Service = new WebTranslationService();
            Repeater.Translation += new TranslationEventHandler(ServiceOnTranslation);
            Service.AddEventRepeater(Repeater);
        }
开发者ID:swatt6400,项目名称:NetOffice,代码行数:17,代码来源:FormMain.cs


示例16: StartImpl

 protected override void StartImpl()
 {
     this._channel = new IpcServerChannel(new Dictionary<Object, Object>()
     {
         {"name", ""},
         {"secure", true},
         {"portName", this._portName},
     }, new BinaryServerFormatterSinkProvider()
     {
         TypeFilterLevel = TypeFilterLevel.Full,
     });
     ChannelServices.RegisterChannel(this._channel, false);
     RemotingServices.Marshal((MarshalByRefObject) this.Host, "", typeof(IServerCore));
 }
开发者ID:takeshik,项目名称:metatweet-old,代码行数:14,代码来源:RemotingIpcServant.cs


示例17: Main

        static int Main(string[] args)
        {
            if ((args.Length == 2) && (args[0].Equals("-iphonepackager")))
            {
				try
				{
					// We were run as a 'child' process, quit when our 'parent' process exits
					// There is no parent-child relationship WRT windows, it's self-imposed.
					int ParentPID = int.Parse(args[1]);

					DeploymentProxy.Deployer = new DeploymentImplementation();
					IpcServerChannel Channel = new IpcServerChannel("iPhonePackager");
					ChannelServices.RegisterChannel(Channel, false);
					RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentProxy), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton);

					Process ParentProcess = Process.GetProcessById(ParentPID);
					while (!ParentProcess.HasExited)
					{
						CoreFoundationRunLoop.RunLoopRunInMode(CoreFoundationRunLoop.kCFRunLoopDefaultMode(), 1.0, 0);
					}
				}
				catch (System.Exception Ex)
				{
					Console.WriteLine(Ex.Message);
				}
            }
            else
            {
				// Parse the command
				if (ParseCommand(args))
				{
					Deployer = new DeploymentImplementation();
					bool bCommandComplete = false;
					System.Threading.Thread enumerateLoop = new System.Threading.Thread(delegate()
					{
						RunCommand();
						bCommandComplete = true;
					});
					enumerateLoop.Start();
					while (!bCommandComplete)
					{
						CoreFoundationRunLoop.RunLoopRunInMode(CoreFoundationRunLoop.kCFRunLoopDefaultMode(), 1.0, 0);
					}
				}
                Console.WriteLine("Exiting.");
            }

			Environment.ExitCode = Program.ExitCode;
			return Program.ExitCode;
        }
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:50,代码来源:Program.cs


示例18: EntryPoint

        public EntryPoint(RemoteHooking.IContext InContext, string InChannelName)
        {
            _interface = RemoteHooking.IpcConnectClient<OverlayInterface>(InChannelName);
            _interface.Ping();

            IDictionary properties = new Hashtable();
            properties["name"] = InChannelName;
            properties["portName"] = InChannelName + Guid.NewGuid().ToString("N");

            BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
            provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

            _serverChannel = new IpcServerChannel(properties, provider);
            ChannelServices.RegisterChannel(_serverChannel, false);
        }
开发者ID:JoshuaTyree,项目名称:DX11OverlayExample,代码行数:15,代码来源:EntryPoint.cs


示例19: IpcChannel

 public IpcChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider, CommonSecurityDescriptor securityDescriptor)
 {
     this._channelPriority = 20;
     this._channelName = "ipc";
     Hashtable hashtable = new Hashtable();
     Hashtable hashtable2 = new Hashtable();
     bool flag = false;
     if (properties != null)
     {
         foreach (DictionaryEntry entry in properties)
         {
             string key = (string) entry.Key;
             if (key == null)
             {
                 goto Label_00CC;
             }
             if (!(key == "name"))
             {
                 if (key == "priority")
                 {
                     goto Label_0098;
                 }
                 if (key == "portName")
                 {
                     goto Label_00B6;
                 }
                 goto Label_00CC;
             }
             this._channelName = (string) entry.Value;
             continue;
         Label_0098:
             this._channelPriority = Convert.ToInt32((string) entry.Value, CultureInfo.InvariantCulture);
             continue;
         Label_00B6:
             hashtable2["portName"] = entry.Value;
             flag = true;
             continue;
         Label_00CC:
             hashtable[entry.Key] = entry.Value;
             hashtable2[entry.Key] = entry.Value;
         }
     }
     this._clientChannel = new IpcClientChannel(hashtable, clientSinkProvider);
     if (flag)
     {
         this._serverChannel = new IpcServerChannel(hashtable2, serverSinkProvider, securityDescriptor);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:IpcChannel.cs


示例20: InitializeServer

        public static void InitializeServer(string objectUri, string portName, System.Type type)
        {
            if (_serverChannel != null) {
                Logger.Info("IpcHelper.InitializeServer chiude il canale aperto ...");
                ChannelServices.UnregisterChannel(_serverChannel);
            }

            Hashtable props = new Hashtable();
            props.Add("authorizedGroup", "Everyone");
            props.Add("portName", portName);
            props.Add("exclusiveAddressUse", "false");
            _serverChannel = new IpcServerChannel(props, null, null);
            ChannelServices.RegisterChannel(_serverChannel, false);
            RemotingConfiguration.RegisterWellKnownServiceType(type, objectUri, WellKnownObjectMode.SingleCall);
            Logger.Info("CacheService inizializzato");
        }
开发者ID:mariocosmi,项目名称:Worker,代码行数:16,代码来源:IpcHelper.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Tcp.TcpChannel类代码示例发布时间:2022-05-26
下一篇:
C# Ipc.IpcClientChannel类代码示例发布时间: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