Package org.snmp4j

Examples of org.snmp4j.TransportMapping


  }

  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


        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

        Snmp snmp;
        try {
            OctetString community1 = new OctetString(community);
            String host = ipAddress + "/" + port;
            Address tHost = new UdpAddress(host);
            TransportMapping transport = new DefaultUdpTransportMapping();
            transport.listen();
            CommunityTarget comtarget = new CommunityTarget();
            comtarget.setCommunity(community1);
            comtarget.setVersion(SnmpConstants.version1);
            comtarget.setAddress(tHost);
            comtarget.setRetries(2);
View Full Code Here

    public void SNMP_SET(String ipAddress, int port, String strOID, String value, String community) {
        ipAddress = ipAddress + "/" + port;
        Address tHost = GenericAddress.parse(ipAddress);
        Snmp snmp;
        try {
            TransportMapping transport = new DefaultUdpTransportMapping();
            snmp = new Snmp(transport);
            transport.listen();
            CommunityTarget target = new CommunityTarget();
            target.setCommunity(new OctetString(community));
            target.setAddress(tHost);
            target.setRetries(2);
            target.setTimeout(5000);
View Full Code Here

        Snmp snmp;
        try {
            OctetString community1 = new OctetString(community);
            String host = ipAddress + "/" + port;
            Address tHost = new UdpAddress(host);
            TransportMapping transport = new DefaultUdpTransportMapping();
            transport.listen();
            CommunityTarget comtarget = new CommunityTarget();
            comtarget.setCommunity(community1);
            comtarget.setVersion(SnmpConstants.version1);
            comtarget.setAddress(tHost);
            comtarget.setRetries(2);
View Full Code Here

    public void SNMP_SET(String ipAddress, int port, String strOID, String value, String community) {
        ipAddress = ipAddress + "/" + port;
        Address tHost = GenericAddress.parse(ipAddress);
        Snmp snmp;
        try {
            TransportMapping transport = new DefaultUdpTransportMapping();
            snmp = new Snmp(transport);
            transport.listen();
            CommunityTarget target = new CommunityTarget();
            target.setCommunity(new OctetString(community));
            target.setAddress(tHost);
            target.setRetries(2);
            target.setTimeout(5000);
View Full Code Here

        Snmp snmp;
        try {
            OctetString community1 = new OctetString(community);
            String host = ipAddress + "/" + port;
            Address tHost = new UdpAddress(host);
            TransportMapping transport = new DefaultUdpTransportMapping();
            transport.listen();
            CommunityTarget comtarget = new CommunityTarget();
            comtarget.setCommunity(community1);
            comtarget.setVersion(SnmpConstants.version1);
            comtarget.setAddress(tHost);
            comtarget.setRetries(2);
View Full Code Here

  }

  public void disconnect(Address masterAddress) throws IOException {
    AgentXPeer peer = (AgentXPeer) peers.remove(masterAddress);
    if (peer != null) {
      TransportMapping transport = peer.getTransport();
      if (transport instanceof ConnectionOrientedTransportMapping) {
        ((ConnectionOrientedTransportMapping)transport).close(masterAddress);
      }
    }
  }
View Full Code Here

  }

  public int connect(Address masterAddress, Address localAddress,
                     AgentXSession session) throws IOException {
    AgentXPeer peer = (AgentXPeer) peers.get(masterAddress);
    TransportMapping transport;
    if (peer == null) {
      transport = addMaster(localAddress);
      peer = new AgentXPeer(transport, masterAddress);
    }
    else {
      transport = peer.getTransport();
      agentX.removeTransportMapping(transport);
      agentX.addTransportMapping(transport);
      if (!transport.isListening()) {
        transport.listen();
      }
    }
    peer.setTimeout(session.getTimeout());
    session.setPeer(peer);
    int status = AgentXProtocol.AGENTX_TIMEOUT;
View Full Code Here

        logger.error(ex);
      }
      agentX.removeTransportMapping(transport);
    }
*/
    TransportMapping transport =
          TransportMappings.getInstance().createTransportMapping(localAddress);
    if (transport instanceof ConnectionOrientedTransportMapping) {
      ConnectionOrientedTransportMapping tcpTransport =
          (ConnectionOrientedTransportMapping)transport;
      tcpTransport.setConnectionTimeout(0);
      tcpTransport.setMessageLengthDecoder(new AgentXProtocol());
    }
    agentX.addTransportMapping(transport);
    transport.listen();
    return transport;
  }
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.