public static void Main(string [] args)
        {
            TcpChannel chan = new TcpChannel();
            ChannelServices.RegisterChannel(chan);

                ObjetoRemoto obj = (ObjetoRemoto) Activator.GetObject(
                typeof(TestCode.Remoting.ObjetoRemoto),
                    "tcp://127.0.0.1:9191/ObjetoRemoto");
                if( obj.Equals(null) )
                {
                    System.Console.WriteLine("Error: no se puede localizar el servidor");
                }
                else
                {
                    SampleClient client = new SampleClient();
                    AsyncCallback fin_llamada_asincrona = new AsyncCallback(client.fin_contador);
                    RemoteAsyncDelegate RemoteDel = new RemoteAsyncDelegate(obj.contador);
                    while (true){
                        Console.WriteLine("Empezar a contar");
                        Console.ReadLine();
                        IAsyncResult RemAr = RemoteDel.BeginInvoke(ref client.cuenta, fin_llamada_asincrona, null);

                        // Esperar a que la llamada termine: Si se quita while ya no espera
                        int y = 0;
                        while(!RemAr.IsCompleted){
                      //Console.WriteLine("Enviando petición al servidor, espere por favor: ");
                            //Console.WriteLine((++y));
                      Thread.Sleep(10);
                        }
                    }
                }
        }
        public static void Main(string [] args)
        {
            IDictionary channelProperties = new Hashtable();
                channelProperties["timeout"] = 2000;
                HttpChannel channel = new HttpChannel(channelProperties,
                        new SoapClientFormatterSinkProvider(),
                        new SoapServerFormatterSinkProvider());

                ChannelServices.RegisterChannel(channel);

                SampleClient client = new SampleClient();
                Console.WriteLine("Empezar a contar");
                Console.ReadLine();
                client.llamada_remota();
                Console.WriteLine("Ejecucion terminada");
        }
        public static void Main(string [] args)
        {
            TcpChannel chan = new TcpChannel();
            ChannelServices.RegisterChannel(chan);

                SampleClient client = new SampleClient();
                while (true){
                        Console.WriteLine("Empezar a contar");
                        Console.ReadLine();
               			ThreadStart delegate_metodo = new ThreadStart (client.envuelto);
                  Thread thread_m = new Thread (delegate_metodo);
                        thread_m.Start();
                        Thread.Sleep(1000);
                        thread_m.Abort();
                }
                        Console.WriteLine("Ejecucion terminada");
        }