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



31
32
33
34
35
36
37
38
39
40
# File 'lib/cosmos/io/cosmos_snmp.rb', line 31

def recv(max_bytes)
  # Implement blocking using recvfrom_nonblock to prevent potential
  # ruby thread deadlock

  data, host_info = @socket.recvfrom_nonblock(max_bytes)
  return data
rescue Errno::EAGAIN, Errno::EWOULDBLOCK
  IO.fast_select([@socket])
  retry
end