Package org.snmp4j

Examples of org.snmp4j.TransportMapping


  }

  protected void addListenAddresses(MessageDispatcher md, List addresses) {
    for (Iterator it = addresses.iterator(); it.hasNext();) {
      Address address = GenericAddress.parse((String)it.next());
      TransportMapping tm =
          TransportMappings.getInstance().createTransportMapping(address);
      if (tm != null) {
        md.addTransportMapping(tm);
      }
      else {
View Full Code Here


    }
    event.setProcessed(true);
  }

  private void closePeer(AgentXPeer peer) {
    TransportMapping transport = peer.getTransport();
    if (transport instanceof ConnectionOrientedTransportMapping) {
      try {
        if (((ConnectionOrientedTransportMapping)
             transport).close(peer.getAddress())) {
          if (LOGGER.isInfoEnabled()) {
View Full Code Here

    int ret = 0;   
    address= address + "/" + port;
   
    try {
      Address targetaddress = new UdpAddress(address);
      TransportMapping transport = new DefaultUdpTransportMapping();
      transport.listen();
      CommunityTarget comtarget = new CommunityTarget();
      comtarget.setCommunity(new OctetString(community));
      comtarget.setVersion(SnmpConstants.version1);
      comtarget.setAddress(targetaddress);
      comtarget.setRetries(2);
View Full Code Here

    address = address + "/" + port;
    Address targetAddress = GenericAddress.parse(address);
    Snmp snmp;
   
    try {
      TransportMapping transport = new DefaultUdpTransportMapping();
      snmp = new Snmp(transport);
      CommunityTarget target = new CommunityTarget();
      target.setCommunity(new OctetString(community));
      target.setAddress(targetAddress);
      target.setRetries(0);
View Full Code Here

        new MultiThreadedMessageDispatcher(threadPool,
                                           new MessageDispatcherImpl());
    listenAddress =
        GenericAddress.parse(System.getProperty("snmp4j.listenAddress",
                                                "udp:0.0.0.0/162"));
    TransportMapping transport;
    if (listenAddress instanceof UdpAddress) {
      transport = new DefaultUdpTransportMapping((UdpAddress)listenAddress);
    }
    else {
      transport = new DefaultTcpTransportMapping((TcpAddress)listenAddress);
View Full Code Here

    }

    protected void initTransportMappings() throws IOException {
        transportMappings = new TransportMapping[1];
        Address addr = GenericAddress.parse(address);
        TransportMapping tm = TransportMappings.getInstance().createTransportMapping(addr);
        transportMappings[0] = tm;
    }
View Full Code Here

      return null;
    }
    String ipAddress = address.toString();
    HashMap<String, String> oid = new HashMap<String, String>();
    ResponseEvent response = null;
    TransportMapping transport = null;
    String oidValue = "0";
    //int count = 0;
    Properties p = new Properties();
    final File f = new File(IO.userDir, "MIB");
    String descr;
    // read from File MIB the oids to request over SNMP
    Logger.debug("Loading MIB");
    FileInputStream fis = null;
    try {
      fis = new FileInputStream(f);
      p.load(fis);
    } catch (IOException e) {
      Logger.error("Failed to open MIB.", e);
    } finally {
      try {
        fis.close();
      } catch (Exception e) {
      }
    }// end reading

    try {
      transport = new DefaultUdpTransportMapping();
      transport.listen();
    } catch (IOException e) {
    }
    // Create Target Address object
    CommunityTarget comtarget = new CommunityTarget();
    comtarget.setCommunity(new OctetString(Settings.get("snmp.community", "public")));
View Full Code Here

TOP

Related Classes of org.snmp4j.TransportMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.