[SNMP4J] receiving traps
Eugene R. Snider
gene at cvtt.net
Tue Dec 18 14:26:30 CET 2007
Most operating systems will only allow one process to bind to a port at
a time. I would expect the first port bind to succeed and all others to
fail but in some cases perhaps the last binding wins. Normally the trap
receiver would handle the trap/inform message and then propagate the
event to other on board processes using a local IPC method.
Gene
SARRA SABRINA - technolabs wrote:
> Hi all,
> I'm using snmp4j in my application receiving trap on a fixed port
> (i.e.5110) but I noted the following problem:
>
> If I run 2 instance of the application, I receve the traps only on the
> last instance, the port bind is done to the second instance run.
> Below there is my code of init session, is it correct?
> Is it possible to receive traps on the same port on both applications?
> Is it possible to bind the same port?
>
> I hope somebody help me.
> Thanks,
> Best regards,
> Sabrina
>
> threadPool = ThreadPool.create("Trap", 2);
> dispatcher = new MultiThreadedMessageDispatcher(threadPool, new
> MessageDispatcherImpl());
> // Get Host IP Address to listen traps
>
> String ipaddr = getIPTrap();
> String Listen_Port ="5110";
> listenAddress = GenericAddress.parse("udp:"+ipaddr+"/"+Listen_Port);
> TransportMapping transport;
>
> if (listenAddress instanceof UdpAddress) {
> transport = new
> DefaultUdpTransportMapping((UdpAddress)listenAddress,true);
> }
> else {
> transport = new
> DefaultTcpTransportMapping((TcpAddress)listenAddress);
> }
>
> snmp = new Snmp(dispatcher, transport);
> snmp.getMessageDispatcher().addMessageProcessingModel(new MPv1());
> snmp.getMessageDispatcher().addMessageProcessingModel(new MPv2c());
> snmp.getMessageDispatcher().addMessageProcessingModel(new MPv3());
> USM usm = new USM(SecurityProtocols.getInstance(), new
> OctetString(MPv3.createLocalEngineID()), 0);
> SecurityModels.getInstance().addSecurityModel(usm);
> snmp.addTransportMapping(transport);
> snmp.listen();
>
> <mailto:sabrina.sarra at technolabs.it>
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>
More information about the SNMP4J
mailing list