当前位置: 首页>>代码示例>>C#>>正文


C# TcpChannel.Parse方法代码示例

本文整理汇总了C#中System.Runtime.Remoting.Channels.Tcp.TcpChannel.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# TcpChannel.Parse方法的具体用法?C# TcpChannel.Parse怎么用?C# TcpChannel.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Runtime.Remoting.Channels.Tcp.TcpChannel的用法示例。


在下文中一共展示了TcpChannel.Parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var serverChannel = new TcpChannel(8082);
            ChannelServices.RegisterChannel(serverChannel);
            RemotingConfiguration.ApplicationName = "TestServer";
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(IServer), "MyServerUri", WellKnownObjectMode.SingleCall);

            // Parse the channel's URI.
            string[] urls = serverChannel.GetUrlsForUri("MyServerUri");
            if (urls.Length > 0) {
                string objectUrl = urls[0];
                string objectUri;
                string channelUri = serverChannel.Parse(objectUrl, out objectUri);
                Console.WriteLine("The object URL is {0}.", objectUrl);
                Console.WriteLine("The object URI is {0}.", objectUri);
                Console.WriteLine("The channel URI is {0}.", channelUri);
            }

            Console.WriteLine("press a key to exit");
            Console.ReadLine();
        }
开发者ID:jeske,项目名称:StepsDB-alpha,代码行数:22,代码来源:_Main_Srv.cs

示例2: ParseURL

		[Test] // TcpChannel.Parse ()
		public void ParseURL ()
		{
			TcpChannel channel;
			int i;
			
			channel = new TcpChannel ();
			
			for (i = 0; i < ParseURLTests.Length; i++) {
				string retval, objectURI;
				
				retval = channel.Parse (ParseURLTests[i].input, out objectURI);
				
				Assert.AreEqual (ParseURLTests[i].retval, retval, "#C1");
				Assert.AreEqual (ParseURLTests[i].objectURI, objectURI, "#C2");
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:17,代码来源:TcpChannelTest.cs

示例3: Main

        static int Main(string[] argv)
        {
            XmlConfigurator.Configure();
            //AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // Get ArchAngel PID from command line arguments
            if (argv.Length != 2)
            {
                Console.WriteLine("This application cannot be run separately from ArchAngel");
                return -1;
            }

            ArchAngelPID = Int32.Parse(argv[0]);
            string uri = argv[1];

            // Create an instance of a channel
            TcpChannel channel = new TcpChannel(0);
            ChannelServices.RegisterChannel(channel, false);

            // Register as an available service with the name CommandReceiver
            // Register as a Singleton so only one runs at a time.
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(CommandReceiver),
                "CommandReceiver",
                WellKnownObjectMode.Singleton);

            ThreadStart start = SearchForArchAngelProcess;
            Thread thread = new Thread(start);
            thread.Start();

            DebugProcessInfoService dpis = (DebugProcessInfoService)Activator.GetObject(
                               typeof(DebugProcessInfoService), uri);

            if (dpis == null)
            {
                // ArchAngel is either not running or not responding. The process should die either way.
                EndDebugProcess.Set();
            }
            else
            {
                // Get the URI of our remoting services, so we can tell the ArchAngel
                // process how to contact us.
                string objectUri = "";
                string[] urls = channel.GetUrlsForUri("CommandReceiver");
                if (urls.Length > 0)
                {
                    string objectUrl = urls[0];
                    string channelUri = channel.Parse(objectUrl, out objectUri);
                    objectUri = channelUri + objectUri;
                }
                if (string.IsNullOrEmpty(objectUri))
                {
                    throw new Exception(
                        "The Debug Process could not register itself with .Net" +
                        "remoting. This is a serious error and must be reported to Slyce.");
                }

                // Inform ArchAngel that we have started.
                dpis.Started(objectUri);
            }

            // Wait for the signal to end the app.
            EndDebugProcess.WaitOne();
            return 0;
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:67,代码来源:Main.cs


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