Method: Rex::IO::Stream#get_once

Defined in:
lib/rex/io/stream.rb

#get_once(length = -1,, timeout = def_read_timeout) ⇒ Object

This method emulates the behavior of Pex::Socket::Recv in MSF2

Raises:

  • (EOFError)


195
196
197
198
199
200
201
202
203
204
205
# File 'lib/rex/io/stream.rb', line 195

def get_once(length = -1, timeout = def_read_timeout)

  if (has_read_data?(timeout) == false)
    return nil
  end

  bsize = (length == -1) ? def_block_size : length
  data  = read(bsize)
  raise EOFError if data.nil?
  data
end