Exemplo n.º 1
0
        public int DoRecieve(INbtInput data)
        {
            byte type;

            try
            {
                do
                {
                    int count = Read(fSessionHeader, 0, HDR_SIZE);

                    if (count < HDR_SIZE)
                    {
                        DoHangup(true);
                        throw new CifsIoException("NB501");
                    }

                    type = fSessionHeader[0];
                } while (type == SPT_KEEPALIVE);

                if (type != SPT_MESSAGE)
                {
                    DoHangup(true);
                    throw new CifsIoException("NB503", type).setConnectionLost();
                }

                int data_size = GetShortAt(HDR_LENGTH_2, fSessionHeader);

                return(data.ReadFrom(fInput, data_size));
            }
            catch (IOException e)
            {
                DoHangup(true);
                throw new CifsIoException("NB501").setDetail(e).setConnectionLost();
            }
        }
Exemplo n.º 2
0
        public int DoRecieve(INbtInput data)
        {
            byte type;

            try
            {
                do
                {
                    int count = Read(fSessionHeader, 0, HDR_SIZE);

                    if(count < HDR_SIZE)
                    {
                        DoHangup(true);
                        throw new CifsIoException("NB501");
                    }

                    type = fSessionHeader[0];

                } while (type == SPT_KEEPALIVE); 

                if (type != SPT_MESSAGE)
                {
                    DoHangup(true);
                    throw new CifsIoException("NB503", type).setConnectionLost();
                }

                int data_size = GetShortAt(HDR_LENGTH_2, fSessionHeader);

                return data.ReadFrom(fInput, data_size);
            }
            catch(IOException e)
            {
                DoHangup(true);
                throw new CifsIoException("NB501").setDetail(e).setConnectionLost();
            }
        }