Example #1
0
        static void ClientThreadLoop(object mrevent)
        {
            ManualResetEvent resetEvent = (ManualResetEvent)mrevent;
            // Construct InstanceContext to handle messages on callback interface
            InstanceContext instanceContext = new InstanceContext(new CallbackHandler());
            _client = ClientHelper.GetDuplexClient(instanceContext,_serverProcId, new ConnectionOptions(),BindingScheme.TCP);
            _client.Open();
            var requestMessage = new RequestMessage();
            var registerMessage = new RegisterMessage { Counter = _counterType };
            Trace.WriteLine(registerMessage.Counter.ToString());
            requestMessage.SetBody(registerMessage);
            _client.Subscribe(requestMessage);
            resetEvent.WaitOne();
            _client.Close();

        }
Example #2
0
        static void ClientThreadLoop(object mrevent)
        {
            ManualResetEvent resetEvent = (ManualResetEvent)mrevent;
            // Construct InstanceContext to handle messages on callback interface
            InstanceContext instanceContext = new InstanceContext(new CallbackHandler());
            _client = ClientHelper.GetDuplexClient(instanceContext,_serverProcId.ToString(), ClientHelper.ServerLocation.REMOTE,"localhost",64000);
            _client.Open();
            var requestMessage = new RequestMessage();
            var registerMessage = new RegisterMessage() { Counter = CounterType.MEMORY };
            Trace.WriteLine(registerMessage.Counter.ToString());
            requestMessage.SetBody<RegisterMessage>(registerMessage);
            _client.Subscribe(requestMessage);
            resetEvent.WaitOne();
            _client.Close();

        }
Example #3
0
        private static void ClientThreadLoop(object connOptions)
        {
            // Construct InstanceContext to handle messages on callback interface
            InstanceContext instanceContext = new InstanceContext(new CallbackHandler());

            _client = ClientHelper.GetDuplexClient(instanceContext, (ConnectionOptions)connOptions, BindingScheme.TCP);
            _client.Open();
            RequestMessage  requestMessage  = new RequestMessage();
            RegisterMessage registerMessage = new RegisterMessage {
                Counter = _counterType
            };

            Trace.WriteLine(registerMessage.Counter.ToString());
            requestMessage.SetBody(registerMessage);
            _client.Subscribe(requestMessage);
            resetEvent.WaitOne();
            _client.Close();
        }