You are on page 1of 1

C:\hoa-gd\distri\java\networkprogramming\Chapter04\Windows Service\MathClient\Client.

cs Page 1 of 1
date:4/8/2012, time:7:25:36 AM

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34:

using using using using using

System; System.Runtime.Remoting; System.Runtime.Remoting.Channels; System.Runtime.Remoting.Channels.Http; MathLibrary;

namespace MathClient { class ClientMain { static void Main(string[] args) { // Go get the remote object Object remoteObj = Activator.GetObject( typeof(MathLibrary.SimpleMath), "http://localhost:13101/SimpleMath.soap" ); // Cast the returned proxy to the SimpleMath type SimpleMath math = (SimpleMath)remoteObj; // Use the remote object do { Console.WriteLine("5 + 2 = {0}", math.Add(5,2)); Console.WriteLine("5 - 2 = {0}", math.Subtract(5,2)); }while(Console.ReadLine()!="q"); // Ask user to press enter Console.Write("Press enter to end"); Console.ReadLine(); } } }

Printed by C-Free

1/1

You might also like