public void Looper() { while(t.IsAlive) { //if(async.Count(i => i.IsCompleted) <= this.asyncLimit) while(async.Where(i => !i.IsCompleted).ToList().Count >= this.asyncLimit) { //Console.Write("."); Thread.Sleep(1); } #region clear out async list List<IAsyncResult> tmp = new List<IAsyncResult>(); foreach(IAsyncResult a in async) { if(!a.IsCompleted) { tmp.Add(a); } } async.AddRange(tmp); #endregion HLState state = new HLState(); //Console.WriteLine("creating HLState.ID: {0}", state.ID); //_listener.GetContext() try { async.Add(_listener.BeginGetContext(new AsyncCallback(this.cb), state)); /*Console.WriteLine("Waiting on incoming..."); IAsyncResult r = _listener.BeginGetContext(new AsyncCallback(this.cb), state); while(!r.IsCompleted) { Console.Write("."); Thread.Sleep(10); }*/ } catch(Exception e) { Console.WriteLine(e); } } }