public static void Main()
    {
        try
        {
            TcpChannel myTcpChannel = new TcpChannel(8086);
            ChannelServices.RegisterChannel(myTcpChannel);
            MyProxy     myProxyObject = new MyProxy(typeof(PrintServer));
            PrintServer myPrintServer = (PrintServer)myProxyObject.GetTransparentProxy();
            if (myPrintServer == null)
            {
                Console.WriteLine("Could not locate server");
            }
            else
            {
                Console.WriteLine(myPrintServer.MyPrintMethod("String1", 1.2, 6));
            }
            Console.WriteLine("Calling the Proxy");
            int kValue = myPrintServer.MyPrintMethod("String1", 1.2, 6);
            Console.WriteLine("Checking result");

            if (kValue == 6)
            {
                Console.WriteLine("PrintServer.MyPrintMethod PASSED : returned {0}",
                                  kValue);
            }
            else
            {
                Console.WriteLine("PrintServer.MyPrintMethod FAILED : returned {0}",
                                  kValue);
            }
            Console.WriteLine("Sample Done");
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception caught!!!");
            Console.WriteLine("The source of exception: " + e.Source);
            Console.WriteLine("The Message of exception: " + e.Message);
        }
    }