OpenHome.Net.Runner.PollSubscribe C# (CSharp) Method

PollSubscribe() private method

private PollSubscribe ( ) : void
return void
        private void PollSubscribe()
        {
            iSubscriptionSem = new Semaphore(0, 1);
            for (int i=0; i<iDeviceList.Count; i++)
            {
                ControlPoint.ICpDevice device = iDeviceList[i];
                string udn = device.Udn();
                if (udn == "896659847466-a4badbeaacbc-737837" ||
                    udn == "541d0cb5-3b34-4264-8ff0-d8653acf6425")
                    continue;
                uint countBefore = iSubscriptionCount;
                Console.Write("Device " + device.Udn());
                ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1 connMgr = new ControlPoint.Proxies.CpProxyUpnpOrgConnectionManager1(device);
                connMgr.SetPropertyChanged(PropertyChanged);
                DateTime startTime = DateTime.Now;
                while(true)
                {
                    connMgr.Subscribe();
                    iSubscriptionSem.WaitOne((int)(2 * kDevicePollMs));
                    connMgr.Unsubscribe();
                    DateTime now = DateTime.Now;
                    if (now.Subtract(startTime).TotalSeconds > kDevicePollSecs)
                    {
                        break;
                    }
                    iSubscriptionCount++;
                }
                Console.Write("    " + (iSubscriptionCount - countBefore) + "\n");
                connMgr.Dispose();
            }
        }