public void WaitForConnections()
 {
     while (isNeeded)
     {
         try
         {
             hlc = hl.GetContext();
         }
         catch
         {
             isNeeded = false;
             return;
         }
         if (hlc.Request.IsWebSocketRequest)
         {
             WSINOUTHandler wsioh = new WSINOUTHandler(this, hlc, Frm);
             wsioh.OnFinished += ws_OnFinished;
             wsIOHandlerList.Add(wsioh);
             new TaskFactory().StartNew(wsioh.DoWSServeClientPostDataIn);
         }
         else
         {
             INOUTHandler ioh = new INOUTHandler(this, hlc);
             ioh.OnFinished += Ioh_OnFinished;
             IOHandlerList.Add(ioh);
             new TaskFactory().StartNew(ioh.DoServeClientDataIn);
         }
     }
 }
 private void ws_OnFinished(WSINOUTHandler sender)
 {
     sender.tIOWriteTimer.Change(-1, -1);
     sender.bInBuff = null;
     sender.hlcIO   = null;
     sender.wsOutWriteList.Clear();
     sender.wsOutWriteList = null;
     wsIOHandlerList.Remove(sender);
 }