Method: Rex::IO::Stream#read
- Defined in:
- lib/rex/io/stream.rb
#read(length = nil, opts = {}) ⇒ Object
This method reads data of the supplied length from the stream.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rex/io/stream.rb', line 69 def read(length = nil, opts = {}) begin return fd.read_nonblock( length ) rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK # Sleep for a half a second, or until we can read again Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 ) # Decrement the block size to handle full sendQs better retry rescue ::IOError, ::Errno::EPIPE return nil end end |