Class: SNMP::UDPServerTransport

Inherits:
Object
  • Object
show all
Defined in:
lib/openc3/io/openc3_snmp.rb

Instance Method Summary collapse

Instance Method Details

#recvfrom(max_bytes) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/openc3/io/openc3_snmp.rb', line 47

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