IAsyncResult BeginRequest(Object sender, EventArgs e, AsyncCallback cb, object state)
        {
            var service = new DelayedHelloSoapClient();
            var delay = _random.Next(1, 5) * 1000;
            var hash = service.GetHashCode();

            Debug.WriteLine("Started " + hash + ", delay: " + delay);
            return service.BeginHelloWorld(delay, cb, service);
        }
示例#2
0
        IAsyncResult BeginRequest(Object sender, EventArgs e, AsyncCallback cb, object state)
        {
            var service = new DelayedHelloSoapClient();
            var delay   = _random.Next(1, 5) * 1000;
            var hash    = service.GetHashCode();

            Debug.WriteLine("Started " + hash + ", delay: " + delay);
            return(service.BeginHelloWorld(delay, cb, service));
        }
        public void IndexAsync()
        {
            var random = new Random();

            for (var i = 0; i < 4; i++)
            {
                AsyncManager.OutstandingOperations.Increment();

                var delay   = random.Next(1, 5) * 1000;
                var service = new DelayedHelloSoapClient();
                service.HelloWorldCompleted += HelloWorldCompleted;
                service.HelloWorldAsync(delay);

                Debug.WriteLine("Started: " + service.GetHashCode());
            }
        }