Sha256: 961b174f03b805f9e97671ff7fb3b0fa47de0c42a55f1a970c2b03a896061822

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 Bytes

Contents

require 'snmpjr/wrappers/transport'

class Snmpjr
  class Session


    def send pdu, target
      snmp = Snmpjr::Wrappers::Snmp.new(Snmpjr::Wrappers::Transport::DefaultUdpTransportMapping.new)
      snmp.listen

      begin
        result = snmp.send(pdu, target)
      rescue
        raise "Failed to send SNMP package"
      ensure
        snmp.close
      end

      result.response.variable_bindings.first.variable.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
snmpjr-0.1.0-java lib/snmpjr/session.rb