/** * Reads the next valid chunk of application data from the queue<br/> * * In blocking mode,this method will block until data is available or the socket is closed, * otherwise it will wait for at most 10 milliseconds. * * @throws InterruptedException */ private void UpdateCurrentChunk(bool block) { if (currentChunk != null) { return; } while (true) { try{ if (block) { currentChunk = receiveBuffer.Poll(1); while (!closed && currentChunk == null) { currentChunk = receiveBuffer.Poll(1000); } } else { currentChunk = receiveBuffer.Poll(10); } }catch (Exception ex) { throw ex; } return; } }