Here are the steps to build the server:
-
Add a reference to the System.Runtime.Remoting.dll assembly.
-
Implement a class that derives from MarshalByRefObject.
-
Choose one of the provided channel implementations (TCP or HTTP), and register it using the ChannelServices.RegisterChannel method.
-
Register the class as a well-known object using the RemotingConfiguration.RegisterWellKnownServiceType method. Keep the server alive waiting for client requests the steps for creating the client are as follows:
-
Add a reference to the System.Remoting.Runtime.Remoting.dll.
-
Add a reference to the assembly containing the metadata for the remote type, in this case MathLibrary.dll.
-
Register a channel object using the same channel type as the server.
-
Call the Activator.GetObject method, passing the appropriate URL, to retrieve a proxy to the remote object.
-
Cast the proxy to the correct type and start using it as if it were the actual object.