[SNMP4J] Freezing when creating an Snmp object
Norman Elton
normelton at gmail.com
Mon Jun 13 22:48:26 CEST 2005
Frank,
Thanks for the reply.
I'm running this on Linux (RedHat Enterprise 3).
I've watched my program alongside "netstat -l", to watch for
listening connections. I see a new UDP connection open when the
program runs as expected. When it closes, the socket seems to close
immediately. When the program hangs; however, the socket appears
immediately, not after the 30 second wait. If your suspicion were
correct, wouldn't the socket appear only after the wait?
I'm going to try making a new transport mapping by copying an
existing one and see how that goes.
Thanks,
Norman
On Jun 13, 2005, at 4:19 PM, Frank Fock wrote:
> 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