public bool HasCompletePacket()
        {
            if (m_bytesInBuffer < 4)
            {
                return(false);
            }

            m_packetLength ??= SessionPacket.GetSessionPacketLength(m_buffer, m_readOffset);
            return(m_bytesInBuffer >= m_packetLength.Value);
        }
Пример #2
0
 public bool HasCompletePacket()
 {
     if (m_bytesInBuffer >= 4)
     {
         if (!m_packetLength.HasValue)
         {
             m_packetLength = SessionPacket.GetSessionPacketLength(m_buffer, m_readOffset);
         }
         return(m_bytesInBuffer >= m_packetLength.Value);
     }
     return(false);
 }
        /// <summary>
        /// HasCompletePacket must be called and return true before calling DequeuePacket
        /// </summary>
        /// <exception cref="InvalidDataException"></exception>
        public SessionPacket DequeuePacket()
        {
            SessionPacket packet;

            try
            {
                packet = SessionPacket.GetSessionPacket(m_buffer, m_readOffset);
            }
            catch (IndexOutOfRangeException ex)
            {
                throw new InvalidDataException("Invalid NetBIOS session packet", ex);
            }
            RemovePacketBytes();
            return(packet);
        }