Exemple #1
0
        public static void Main(string[] args)
        {
            var endPoint = ProtocolEndPointBase.CreateEndPoint("tcp://127.0.0.1:6900");

            _client = new TestClientImplementation();
            _serviceClient = ServiceClientBuilder.CreateClient<ITestServerService>(endPoint, _client);
            _serviceClient.Connected += ClientOnConnected;
            _serviceClient.Disconnected += ClientOnDisconnected;
            _serviceClient.Connect();

            do {
                var cmd = Console.ReadLine();
                if (cmd == "exit") {
                    _serviceClient.Disconnect();
                }
                if (cmd == "void") {
                    _serviceClient.ServiceProxy.RemoteVoid();
                }
                if (cmd == "magic") {
                    var poco = new SimplePoco {Id = 1, Title = "My POCO obj"};
                    _serviceClient.ServiceProxy.SomeRemoteMagic(poco);
                }
                if (cmd == "ex") {
                    _serviceClient.ServiceProxy.RaiseTheException();
                }
            } while (_serviceClient.CommunicationState == CommunicationStates.Connected);

            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            var endPoint = ProtocolEndPointBase.CreateEndPoint("tcp://127.0.0.1:6900");

            _client                      = new TestClientImplementation();
            _serviceClient               = ServiceClientBuilder.CreateClient <ITestServerService>(endPoint, _client);
            _serviceClient.Connected    += ClientOnConnected;
            _serviceClient.Disconnected += ClientOnDisconnected;
            _serviceClient.Connect();

            do
            {
                var cmd = Console.ReadLine();
                if (cmd == "exit")
                {
                    _serviceClient.Disconnect();
                }
                if (cmd == "void")
                {
                    _serviceClient.ServiceProxy.RemoteVoid();
                }
                if (cmd == "magic")
                {
                    var poco = new SimplePoco {
                        Id = 1, Title = "My POCO obj"
                    };
                    _serviceClient.ServiceProxy.SomeRemoteMagic(poco);
                }
                if (cmd == "ex")
                {
                    _serviceClient.ServiceProxy.RaiseTheException();
                }
            } while (_serviceClient.CommunicationState == CommunicationStates.Connected);


            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }