[SNMP4J] Freezing when creating an Snmp object

Frank Fock fock at agentpp.com
Mon Jun 13 22:19:15 CEST 2005


Norman,

I do not think that this problem is related to SNMP4J. What
operating system are you using? There are some OS where
reusing IP sockets may take some time. See Socket.setReuseAddress
for more information on this. SNMP4J does not set this option.
If you need it on your system, you may create your own transport mapping
subclass.

Best regards,
Frank

Norman Elton wrote:

> 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
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>





More information about the SNMP4J mailing list