Dotfuscator User's Guide
Running the Remoting Sample

The first step to running the remoting sample is to launch the TrigServer.exe assembly. This application will register a new HTTP channel listener on port 12345, and register the class Samples.Trig to handle method invocations on that channel. The code from TrigServer that does this is:

TrigServer Code
Copy Code
   // create a channel and start listening
   HttpChannel serverchannel = new HttpChannel(12345);
   Type trigType = Type.GetType("Samples.Trig");
   // register our well-known type
      WellKnownObjectMode.Singleton );

Once the server is established, the client application, TrigClient.exe, can be run. This application establishes an outgoing HTTP channel and connects it to the TrigServer as can be seen in the following code:

Connect to TrigServer Code
Copy Code
   // create a channel for our client call
   HttpChannel clientchannel = new HttpChannel(0);

   // get a reference to the remote Trig server
   MarshalByRefObject rawobject =

After establishing the connection, the client invokes several methods on the remote server object:

Invoked Methods on Remote Server Object
Copy Code
   Console.WriteLine("Cos(0) = {0}", trig.Cos(0.0));
   Console.WriteLine("Sin(0) = {0}", trig.Sin(0.0));
   Console.WriteLine("Cos(PI) = {0}", trig.Cos(trig.PI()));

The output of the client application demonstrates correct operation of the application:

Copy Code
About to make connection to remote server
Cos(0) = 1
Sin(0) = 0
Cos(PI) = -1



© 2017 PreEmptive Solutions, LLC. All Rights Reserved.