class SNMP::UDPServerTransport
Public Class Methods
new(host, port, address_family)
click to toggle source
# File lib/snmp/manager.rb, line 525 def initialize(host, port, address_family) @socket = UDPSocket.open(address_family) @socket.bind(host, port) end
Public Instance Methods
close()
click to toggle source
# File lib/snmp/manager.rb, line 530 def close @socket.close end
recvfrom(max_bytes)
click to toggle source
# File lib/snmp/manager.rb, line 538 def recvfrom(max_bytes) data, host_info = @socket.recvfrom(max_bytes) _, host_port, _, host_ip = host_info return data, host_ip, host_port end
send(data, host, port)
click to toggle source
# File lib/snmp/manager.rb, line 534 def send(data, host, port) @socket.send(data, 0, host, port) end