コード例 #1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            label3.Text = ("Paused");
            timer3.Stop();
            IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject),
                                                                       "http://localhost:1234/MyRemoteObject.soap");
            string a = "a";

            obj.SetValue(a);
        }
コード例 #2
0
        private void button8_Click_1(object sender, EventArgs e)
        {
            label3.Text = ("Paused");
            timer3.Stop();
            IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(typeof(IMyRemoteObject),
                                                                       "http://localhost:1234/MyRemoteObject.soap");
            string a = "a";

            obj.SetValue(a);
            Form3 f3 = new Form3();

            f3.ShowDialog();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            HttpChannel channel = new HttpChannel();

            ChannelServices.RegisterChannel(channel);

            IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(
                typeof(IMyRemoteObject),
                "http://localhost:1234/MyRemoteObject.soap");

            Console.WriteLine("Client.Main(): Reference to rem.obj. acquired");

            int tmp = obj.GetValue();

            Console.WriteLine("Client.Main(): Original server side value: {0}", tmp);
            Console.WriteLine("Client.Main(): Will set value to 42");
            obj.SetValue(42);
            tmp = obj.GetValue();
            Console.WriteLine("Client.Main(): New server side value {0}", tmp);


            Console.ReadLine();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            DateTime start = System.DateTime.Now;

            HttpChannel channel = new HttpChannel();

            ChannelServices.RegisterChannel(channel);
            IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(
                typeof(IMyRemoteObject),
                "http://localhost:1234/MyRemoteObject.soap");

            Console.WriteLine("Client.Main(): Reference to rem.obj. acquired");

            Console.WriteLine("Client.Main(): Will set value to 42");

            obj.SetValue(42);

            Console.WriteLine("Client.Main(): Will now read value");
            int tmp = obj.GetValue();

            Console.WriteLine("Client.Main(): New server side value {0}", tmp);


            Console.WriteLine("Client.Main(): Will call getName()");
            String name = obj.GetName();

            Console.WriteLine("Client.Main(): received name {0}", name);

            DateTime end      = System.DateTime.Now;
            TimeSpan duration = end.Subtract(start);

            Console.WriteLine("Client.Main(): Execution took {0} seconds.",
                              duration.Seconds);

            Console.ReadLine();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            HttpChannel channel = new HttpChannel();

            ChannelServices.RegisterChannel(channel);
            IMyRemoteObject obj = (IMyRemoteObject)Activator.GetObject(
                typeof(IMyRemoteObject),
                "http://localhost:1234/MyRemoteObject.soap");

            Console.WriteLine("Client.Main(): Reference to rem.obj. acquired");

            Console.WriteLine("Client.Main(): Will call setValue(42)");
            try
            {
                obj.SetValue(42);
                Console.WriteLine("Client.Main(): Value successfully set.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Client.Main(): EXCEPTION.\n{0}", e.Message);
            }
            // wait for keypress
            Console.ReadLine();
        }