Created
March 10, 2009 15:45
-
-
Save rkh/76943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "snmp" | |
class UDPSocket | |
alias send_data send | |
end | |
module SNMP | |
def self.socket_class | |
@socket_class ||= UDPSocket | |
end | |
def self.socket_class= value | |
@socket_class = value | |
end | |
class UDPTransport | |
def initialize | |
@socket_class = SNMP.socket_class.open | |
end | |
def send(data, host, port) | |
@socket_class.send_data data, 0, host, port | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment