Пример #1
0
        public int U_Read(Array buff, int offset, int size)
        {
            int realSize = (_queue.Size > size) ? size : _queue.Size;

            _queue.dequeueTo(buff, offset, realSize);
            return(realSize);
        }
Пример #2
0
        // Byte[] tempBuff = new Byte[8192];
        public int read(Array buff, int offset, int size)
        {
            int realSize = (_queue.Size > size) ? size : _queue.Size;

            realSize = (realSize < buff.Length) ? realSize : Buffer.ByteLength(buff);
            _queue.dequeueTo(buff, offset, realSize);
            return(realSize);
        }
Пример #3
0
 public int read(Array buff, int offset, int size)
 {
     if (_isRecvQueueUsing)
     {
         int realSize = (_queue.Size > size) ? size : _queue.Size;
         _queue.dequeueTo(buff, offset, realSize);
         return(realSize);
     }
     else
     {
         Buffer.BlockCopy(_tempBuff, 0, buff, offset, _totalSize);                                    //먼저 이미 저장된 데이터를 가져온다.
         int rest = (_client.Client.Available > 0)? receiveData(buff, offset + _totalSize, size) : 0; //다음에 남은 데이터를 저장한다.
         int all  = rest + _totalSize;
         _totalSize = 0;
         return(all);
     }
 }
Пример #4
0
        public int read(Array buff, int offset, int size)
        {
            if (_isRecvQueueUsing)
            {
                int realSize = (_queue.Size > size) ? size : _queue.Size;
                _queue.dequeueTo(buff, offset, realSize);
                return(realSize);
            }
            else
            {
                Buffer.BlockCopy(_tempBuff, 0, buff, offset, _totalSize); //먼저 이미 저장된 데이터를 가져온다.

                int rest = receiveData(buff, offset + _totalSize, size);  //다음에 남은 데이터를 저장한다.
                if (rest < 0)
                {
                    OnConnectionFailed();
                    return(-1);
                }
                int all = rest + _totalSize;
                _totalSize = 0;
                return(all);
            }
        }