Class: SNMP::UDPTransport
- Inherits:
-
Object
- Object
- SNMP::UDPTransport
- Defined in:
- lib/snmp/manager.rb
Overview
Wrap socket so that it can be easily substituted for testing or for using other transport types (e.g. TCP)
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ UDPTransport
constructor
A new instance of UDPTransport.
- #recv(max_bytes) ⇒ Object
- #send(data, host, port) ⇒ Object
Constructor Details
#initialize ⇒ UDPTransport
Returns a new instance of UDPTransport.
25 26 27 |
# File 'lib/snmp/manager.rb', line 25 def initialize @socket = UDPSocket.open end |
Instance Method Details
#close ⇒ Object
29 30 31 |
# File 'lib/snmp/manager.rb', line 29 def close @socket.close end |
#recv(max_bytes) ⇒ Object
37 38 39 |
# File 'lib/snmp/manager.rb', line 37 def recv(max_bytes) @socket.recv(max_bytes) end |
#send(data, host, port) ⇒ Object
33 34 35 |
# File 'lib/snmp/manager.rb', line 33 def send(data, host, port) @socket.send(data, 0, host, port) end |