⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.cs

📁 网络应用
💻 CS
字号:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
using MathLibrary;

namespace MathClient
{
	class ClientMain
	{
		static void Main(string[] args)
		{
         // Create and register the channel. The default channel ctor 
         // does not open a port, so we can't use this to receive messsages.
			HttpClientChannel channel = new HttpClientChannel();
         ChannelServices.RegisterChannel(channel);

         // Go get the remote object
         Object remoteObj = Activator.GetObject(
                               typeof(MathLibrary.SimpleMath),
                               "http://localhost:13101/myURI.soap"
                            );

         // Cast the returned proxy to the SimpleMath type
         SimpleMath math = (SimpleMath)remoteObj;

         // Use the remote object
         Console.WriteLine("5 + 2 = {0}", math.Add(5,2));
         Console.WriteLine("5 - 2 = {0}", math.Subtract(5,2));

         // Ask user to press enter
         Console.Write("Press enter to end");
         Console.ReadLine();
      }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -