Method: Rex::IO::Stream#timed_read

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

#timed_read(length = nil, wait = def_read_timeout, opts = {}) ⇒ Object

This method reads from the stream, optionally timing out after a period of time.



156
157
158
159
160
161
162
163
164
# File 'lib/rex/io/stream.rb', line 156

def timed_read(length = nil, wait = def_read_timeout, opts = {})
  if (wait and wait > 0)
    Timeout.timeout(wait) {
      return read(length, opts)
    }
  else
    return read(length, opts)
  end
end