[SNMP4J] Freezing when creating an Snmp object

Norman Elton normelton at gmail.com
Mon Jun 13 21:50:16 CEST 2005


I've got the following three lines of code...

TransportMapping transport = new DefaultUdpTransportMapping();
snmp = new Snmp(transport);
transport.listen();

For some reason, the code tends to hang for anywhere from 2-30  
seconds after I call the second line. I've diagnosed this by putting  
System.out calls in between each line.

I've noticed that this problem is more reproducible if I execute my  
program immediately after it stops. If I wait a few minutes, the code  
runs as expected. I am calling snmp.close() before exiting, to close  
any sockets and stop the listening thread.

Are there any other resources that need to be freed up? Is there some  
case that would cause the Snmp constructor to hang?

Thanks,

Norman Elton




More information about the SNMP4J mailing list