本文整理了Java中org.snmp4j.Snmp.addCommandResponder()
方法的一些代码示例,展示了Snmp.addCommandResponder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Snmp.addCommandResponder()
方法的具体详情如下:
包路径:org.snmp4j.Snmp
类名称:Snmp
方法名:addCommandResponder
[英]Adds a CommandResponder
to this SNMP session. The command responder will then be informed about incoming SNMP PDUs of any kind that are not related to any outstanding requests of this SNMP session.
[中]将CommandResponder
添加到此SNMP会话。然后,命令响应者将被告知与此SNMP会话的任何未完成请求无关的任何类型的传入SNMP PDU。
代码示例来源:origin: com.rogueai/snmp2bean
public void start() throws Exception {
init();
snmp.addCommandResponder(this);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
public void run() {
try {
init();
snmp.addCommandResponder(this);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: org.kaazing/snmp4j
public void run() {
try {
init();
snmp.addCommandResponder(this);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
private void initSession(){
this.session = new Snmp(dispatcher);
for (int i = 0; i < transportMappings.length;i++){
try{
session.addTransportMapping(transportMappings[i]);
}
catch(Exception e){
log.warn("Tranport mapping invalid. Failed to initialize mapping '"+
transportMappings[i]+"' with: "+e.getMessage());
}
}
this.session.addCommandResponder(responder);
}
代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core
private void initSession(){
this.session = new Snmp(dispatcher);
for (int i = 0; i < transportMappings.length;i++){
try{
session.addTransportMapping(transportMappings[i]);
}
catch(Exception e){
log.warn("Tranport mapping invalid. Failed to initialize mapping '"+
transportMappings[i]+"' with: "+e.getMessage());
}
}
this.session.addCommandResponder(responder);
}
代码示例来源:origin: org.apache.servicemix/servicemix-snmp
@Override
public synchronized void activate() throws Exception {
super.activate();
// load connection data only if the endpoint is enabled
if (isEnabled()) {
logger.debug("Activating endpoint");
this.listenGenericAddress = GenericAddress.parse(this.address);
this.transport = new DefaultUdpTransportMapping((UdpAddress) this.listenGenericAddress);
this.snmp = new Snmp(transport);
snmp.addCommandResponder(this);
}
}
代码示例来源:origin: org.apache.camel/camel-snmp
@Override
protected void doStart() throws Exception {
super.doStart();
// load connection data only if the endpoint is enabled
if (LOG.isInfoEnabled()) {
LOG.info("Starting trap consumer on {}", this.endpoint.getAddress());
}
this.listenGenericAddress = GenericAddress.parse(this.endpoint.getAddress());
// either tcp or udp
if ("tcp".equals(endpoint.getProtocol())) {
this.transport = new DefaultTcpTransportMapping((TcpAddress)this.listenGenericAddress);
} else if ("udp".equals(endpoint.getProtocol())) {
this.transport = new DefaultUdpTransportMapping((UdpAddress)this.listenGenericAddress);
} else {
throw new IllegalArgumentException("Unknown protocol: " + endpoint.getProtocol());
}
this.snmp = new Snmp(transport);
this.snmp.addCommandResponder(this);
// listen to the transport
if (LOG.isDebugEnabled()) {
LOG.debug("Starting trap consumer on {} using {} protocol", endpoint.getAddress(), endpoint.getProtocol());
}
this.transport.listen();
if (LOG.isInfoEnabled()) {
LOG.info("Started trap consumer on {} using {} protocol", endpoint.getAddress(), endpoint.getProtocol());
}
}
代码示例来源:origin: fbacchella/jrds
@Override
public boolean start() {
try {
TransportMapping<?> transport = null;
if(UDP.equals(proto)) {
UdpAddress listenAddress = new UdpAddress(port);
transport = new DefaultUdpTransportMapping(listenAddress, true);
}
if(transport != null) {
snmp = new Snmp(transport);
snmp.addCommandResponder(trapReceiver);
transport.listen();
} else {
log(Level.ERROR, "unsupported UDP listener protocol: %s", proto);
return false;
}
return super.start();
} catch (IOException e) {
log(Level.ERROR, e, "failed to start the trap listener: %s", e.getMessage());
return false;
}
}
代码示例来源:origin: stackoverflow.com
new OctetString("saikrishnapassword"), PrivDES.ID,
new OctetString("PasswordUser")));
snmp.addCommandResponder(this);
代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j
public void registerForTraps(TrapNotificationListener listener, TrapProcessorFactory processorFactory, int snmpTrapPort) throws IOException {
RegistrationInfo info = new RegistrationInfo(listener, snmpTrapPort);
Snmp4JTrapNotifier m_trapHandler = new Snmp4JTrapNotifier(listener, processorFactory);
info.setHandler(m_trapHandler);
TransportMapping transport = new DefaultUdpTransportMapping(new UdpAddress(snmpTrapPort));
info.setTransportMapping(transport);
Snmp snmp = new Snmp(transport);
snmp.addCommandResponder(m_trapHandler);
info.setSession(snmp);
s_registrations.put(listener, info);
snmp.listen();
}
代码示例来源:origin: OpenNMS/opennms
public MockProxy(int port) throws IOException {
// Set socket option SO_REUSEADDR so that we can bind to the port even if it
// has recently been closed by passing 'true' as the second argument here.
m_transport = new DefaultUdpTransportMapping(new UdpAddress(InetAddress.getLocalHost(), port), true);
m_snmp = new Snmp(m_transport);
m_snmp.addCommandResponder(this);
m_transport.listen();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
if (notificationDispatcher == null) {
notificationDispatcher = new NotificationDispatcher();
addCommandResponder(notificationDispatcher);
代码示例来源:origin: org.snmp4j/snmp4j
if (notificationDispatcher == null) {
notificationDispatcher = new NotificationDispatcher();
addCommandResponder(notificationDispatcher);
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
snmp.addCommandResponder(this);
snmp.listen();
log.debug("listening on: "+address);
代码示例来源:origin: org.opendaylight.cardinal/cardinal-impl
snmp.addCommandResponder(this);
代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core
snmp.addCommandResponder(this);
snmp.listen();
log.debug("listening on: "+address);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
snmp.addCommandResponder(this);
代码示例来源:origin: org.kaazing/snmp4j
snmp.addCommandResponder(this);
代码示例来源:origin: OpenNMS/opennms
Snmp snmp = new Snmp(transport);
Snmp4JStrategy.trackSession(snmp);
snmp.addCommandResponder(trapNotifier);
代码示例来源:origin: org.snmp4j/snmp4j
snmp.addCommandResponder(this);
内容来源于网络,如有侵权,请联系作者删除!