[SNMP4J] Listening for SNMP events

Andrew Chan wingnin at gmail.com
Mon Oct 3 18:39:10 CEST 2005


Hi Jason,
  I am also new to SNMP4J, but I've wrote a simliar sample program last
week, they way I solve the problem is after triggered the listen function
(from the main), I perform a while (true) loop, something like
 int ch = 0;
while (ch != -1) {
 ch = System.in.read();
}
 So it won't end unless you press Ctrl-Z from the console. Of course, this
is just a sample program, I believe there are ton's of ways to keep your
program alive.
 Regards,
AC

 On 9/30/05, Jason Ruthkoski <jtruth33 at yahoo.com> wrote:
>
> I'm trying to set up a simple Java program that let's
> me listen and receive SNMP events from my machine (I'm
> running windows XP).
>
> I ran acroos this under the listen function for the
> DefaultUdpTransportMapping class:
>
> "Starts the listener thread that accepts incoming
> messages. The thread is started in daemon mode and
> thus it will not block application terminated."
>
> If this is the case, how can I get my application to
> not terminate so it can sit and listen for events?
>
> Also, to set up the app to just listen for events,
> which method is correct to set up the connection (I've
> run across both in the documentation)?:
>
> Address targetAddress =
> GenericAddress.parse("udp:127.0.0.1/161") <http://127.0.0.1/161")>;
> TransportMapping Transport = new
> DefaultUdpTransportMapping();
>
>
> or...
>
> TransportMapping Transport = new
> DefaultUdpTransportMapping(new
> UdpAddress("127.0.0.1/160") <http://127.0.0.1/160")>;
>
>
> Thank you,
>
> Jason Ruthkoski
> jtruth33 at yahoo.com
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>



More information about the SNMP4J mailing list