Пример #1
0
        static void Main(string[] args)
        {
            RemotingConfiguration.Configure("HelloClient.exe.config");

            Hello obj = new Hello();

            if (obj == null)
            {
                Console.WriteLine("could not locate server");
                return;
            }

             CallContextData cookie = new CallContextData();
             cookie.Data = "information for the server";
             CallContext.SetData("mycookie", cookie);
             for (int i=0; i< 5; i++)
             {
            Console.WriteLine(obj.Greeting("Christian"));
             }

            for (int i=0; i< 5; i++)
            {
                Console.WriteLine(obj.Greeting("Christian"));
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            RemotingConfiguration.Configure("HelloClient.exe.config");

            Hello obj = new Hello();

            if (obj == null)
            {
                Console.WriteLine("could not locate server");
                return;
            }

            CallContextData cookie = new CallContextData();

            cookie.Data = "information for the server";
            CallContext.SetData("mycookie", cookie);
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine(obj.Greeting("Christian"));
            }


            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine(obj.Greeting("Christian"));
            }
        }
Пример #3
0
        public string Greeting(string name)
        {
            Console.WriteLine("Greeting called");

            CallContextData cookie =
                (CallContextData)CallContext.GetData("mycookie");

            if (cookie != null)
            {
                Console.WriteLine("Cookie: " + cookie.Data);
            }

            return("Hello, " + name);
        }