Class: SNMP::UDPServerTransport
- Inherits:
-
Object
- Object
- SNMP::UDPServerTransport
- Defined in:
- lib/snmp/manager.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(host, port) ⇒ UDPServerTransport
constructor
A new instance of UDPServerTransport.
- #recvfrom(max_bytes) ⇒ Object
- #send(data, host, port) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ UDPServerTransport
Returns a new instance of UDPServerTransport.
497 498 499 500 |
# File 'lib/snmp/manager.rb', line 497 def initialize(host, port) @socket = UDPSocket.open @socket.bind(host, port) end |
Instance Method Details
#close ⇒ Object
502 503 504 |
# File 'lib/snmp/manager.rb', line 502 def close @socket.close end |
#recvfrom(max_bytes) ⇒ Object
510 511 512 513 514 |
# File 'lib/snmp/manager.rb', line 510 def recvfrom(max_bytes) data, host_info = @socket.recvfrom(max_bytes) flags, host_port, host_name, host_ip = host_info return data, host_ip, host_port end |
#send(data, host, port) ⇒ Object
506 507 508 |
# File 'lib/snmp/manager.rb', line 506 def send(data, host, port) @socket.send(data, 0, host, port) end |