[SNMP4J] Sending traps and receiving/responding to requests...
Bruno Tessier
btessier at nakinasystems.com
Thu Apr 6 18:52:03 CEST 2006
Thanks Frank, your help and responsiveness is always appreciated.
About 5 minutes before you replied, I ended up figuring it out. I dug
through the code, down to the TransportMapping, and found out what you
just mentioned. I guess I've learned my lesson: never pull the trigger
too quickly again (especially when we have access to the source code
like that)! If I had dug through the code in the first place, I
would've saved you and others some time...
Thanks again, and sorry for the trouble.
Bruno
> -----Original Message-----
> From: Frank Fock [mailto:fock at agentpp.com]
> Sent: Thursday, April 06, 2006 12:46 PM
> To: Bruno Tessier
> Cc: snmp4j at agentpp.org
> Subject: Re: [SNMP4J] Sending traps and receiving/responding
> to requests...
>
>
> Hi,
>
> By calling "this.wait();" you are suspending the current
> thread. If you do this inside the processPdu method you
> create a deadlock.
>
> Normally "this.wait();" is not necessary nor feasible
> to wait for an incoming request. The "waiting" is already
> done in the TransportMapping instance.
>
> Best regards,
> Frank
>
>
> Bruno Tessier wrote:
> > Oh, I forgot to explain that I want my application (agent) to be
> > waiting around for incoming GET requests, which is why I am
> using the
> > call to "this.wait()". When a request comes in, it will
> process it,
> > send the response, and go back to waiting mode. But while it is
> > waiting (or even while it is processing requests), I would
> also like
> > to be able to send traps from it, when some conditions that
> my agent
> > is monitoring are met.
> >
> >
> > As mentioned in my previous message, I would like to be
> able to do all
> > of this from the same application, using the same Snmp
> object. I've
> > been able to send traps, I've been able to wait for
> incoming requests
> > and process them, but I haven't been able yet to get both
> to work in
> > the same app using the same Snmp object. It seems the call to
> > "this.wait()" (is this really needed, or is there another
> way to make
> > my app wait for incoming requests?) blocks my app from
> doing anything
> > else, in this case, send traps.
> >
> > Any ideas, examples, anything?
> >
> > Thanks
> >
> >
> >> -----Original Message-----
> >> From: Bruno Tessier
> >> Sent: Wednesday, April 05, 2006 5:03 PM
> >> To: 'snmp4j at agentpp.org'
> >> Subject: Sending traps and receiving/responding to requests...
> >>
> >> Hi,
> >>
> >> This is similar to another topic posted in March, but in this
> >> case the roles are reversed. While the other topic was about
> >> receiving traps and sending requests using the same Snmp
> >> (snmp4j class) instance (i.e. creating a manager), mine is
> >> about sending traps and receiving requests using the same
> >> Snmp instance (i.e. creating an agent). I read through the
> >> answer of the other topic I'm talking about (title: [SNMP4J]
> >> Writinf SNMP Manager using SNMP4J), and I doubt it would help
> >> in my case.
> >>
> >> I would like to do both things (send traps and receive
> >> requests) in the same class, using the same Snmp instance, is
> >> is possible?
> >>
> >> Right now, my class extends Thread and implements
> >> CommandResponder, and when I initialize the Transport object
> >> and the Snmp object, at one point I call the listen() method
> >> of Transport, and right after that, when I'm ready to have my
> >> class wait for incoming requests, I call "this.wait()". I
> >> can get the incoming requests and process them OK, but the
> >> problem is while my class is waiting for these requests to
> >> come in, I'm trying to trigger it to send a trap, and that is
> >> not working.
> >>
> >> I don't know, maybe I should be using CommandProcessor
> >> instead of CommandResponder, but there not a lot of
> >> documentation about this class and its methods. Any
> >> help/examples available?
> >>
> >> Thanks,
> >> Bruno
> >>
> >>
> > _______________________________________________
> > SNMP4J mailing list
> > SNMP4J at agentpp.org http://lists.agentpp.org/mailman/listinfo/snmp4j
>
> --
> AGENT++
> http://www.agentpp.com
> http://www.mibexplorer.com
> http://www.mibdesigner.com
>
>
More information about the SNMP4J
mailing list