Class: SNMP::UDPTransport

Inherits:
Object show all
Defined in:
lib/cosmos/io/cosmos_snmp.rb

Instance Method Summary collapse

Instance Method Details

#recv(max_bytes) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cosmos/io/cosmos_snmp.rb', line 22

def recv(max_bytes)
  # Implement blocking using recvfrom_nonblock to prevent potential
  # ruby thread deadlock
  begin
    data, host_info = @socket.recvfrom_nonblock(max_bytes)
    return data
  rescue Errno::EAGAIN, Errno::EWOULDBLOCK
    IO.fast_select([@socket])
    retry
  end
end