static void Main(string[] args)
        {
            Console.WriteLine("***** SimpleRemoteObjectClient started! *****");
            Console.WriteLine("Hit enter to end");
            // Create a new HttpChannel
            HttpChannel c = new HttpChannel();

            ChannelServices.RegisterChannel(c);

            // Get a proxy to remote object.
            object remoteObj = Activator.GetObject(
                typeof(SimpleRemotingAsm.RemoteMessageObject),
                "http://localhost:32469/RemoteMsgObj.soap");

            RemoteMessageObject simple = (RemoteMessageObject)remoteObj;

            simple.DisplayMessage("Hello from the client!");
            Console.WriteLine("Server says: {0}", simple.ReturnMessage());

            #region Fun with channel services
            // List all registered channels.
            IChannel[] channelObjs = ChannelServices.RegisteredChannels;
            foreach (IChannel i in channelObjs)
            {
                Console.WriteLine("Channel name: {0}", i.ChannelName);
                Console.WriteLine("Channel Priority: {0}", i.ChannelPriority);
            }
            #endregion

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Client started!  Hit enter to end");
            RemotingConfiguration.Configure("SimpleRemoteObjectClientWithConfig.exe.config");
            RemoteMessageObject simple = new RemoteMessageObject();

            simple.DisplayMessage("Hello from the client!");
            Console.WriteLine("Server says: {0}", simple.ReturnMessage());
            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("*****SimpleRemoteObjectClient started!******");
            Console.WriteLine("Hit enter to end");
            //注册一个新的信道
            HttpChannel c = new HttpChannel();

            ChannelServices.RegisterChannel(c, false);

            //注册一个WKO类型
            object remoteObj = Activator.GetObject(typeof(RemoteMessageObject), "http://localhost:4313/RemoteMsgObj.soap");
            //现在使用远程对象
            RemoteMessageObject simple = (RemoteMessageObject)remoteObj;

            simple.DisplayMessage("Hello from the client");
            Console.WriteLine("Server says:{0}", simple.ReturnMessage());
            Console.ReadLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            // Create a new TcpChannel
            TcpChannel c = new TcpChannel();

            ChannelServices.RegisterChannel(c);

            // Get a proxy to remote object.
            object remoteObj = Activator.GetObject(
                typeof(SimpleRemotingAsm.RemoteMessageObject),
                "tcp://localhost:32469/RemoteMsgObj.rem");

            RemoteMessageObject simple = (RemoteMessageObject)remoteObj;

            simple.DisplayMessage("Hello from the client!");
            Console.WriteLine("Server says: {0}", simple.ReturnMessage());
            Console.WriteLine("Client started!  Hit enter to end");
            Console.ReadLine();
        }