Exemple #1
0
        public bool CopyBuffer(int bytesRead)
        {
            var indx = BufferUtils.IndexOf(socketBuffer, WireFormat.Eof, bytesRead);

            if (indx > -1)
            {
                // Append bytes up to eof
                Buffer.BlockCopy(socketBuffer, 0, dataBuffer, totalBytesRead, indx);

                totalBytesRead += indx;
                return(true);
            }
            else
            {
                // Append all bytes
                Buffer.BlockCopy(socketBuffer, 0, dataBuffer, totalBytesRead, bytesRead);

                totalBytesRead += bytesRead;
                return(false);
            }
        }