Method: Rex::Socket::Udp#timed_read

Defined in:
lib/rex/socket/udp.rb

#timed_read(length = 65535, timeout = def_read_timeout) ⇒ Object

Read a datagram from the UDP socket with a timeout



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/rex/socket/udp.rb', line 74

def timed_read(length = 65535, timeout=def_read_timeout)
  begin
    if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and
        (rv[0]) and (rv[0][0] == fd)
       )
        return read(length)
    else
      return ''
    end
  rescue Exception
    return ''
  end
end