[SNMP4J] Getting IllegalBlockingModeException when receivingtrap via TCP
Frank Fock
fock at agentpp.com
Fri Oct 14 00:04:38 CEST 2005
Hi Fedja,
Yes, TCP is supported for all SNMP operations by SNMP4J.
Please download v1.6RC1 for best results (it contains a fix
regarding TCP support).
Best regards,
Frank
Fedja Jeleskovic wrote:
> Hi Frank,
>
> Is the sending traps over TCP available for the SNMP4J if not for the
> Agent++?
>
> Thanks
>
> Fedja
>
> ----- Original Message ----- From: "Frank Fock" <fock at agentpp.com>
> To: "Mccarty, William (Bill)" <mccarty at avaya.com>
> Cc: <snmp4j at agentpp.org>
> Sent: Thursday, October 13, 2005 2:50 AM
> Subject: Re: [SNMP4J] Getting IllegalBlockingModeException when
> receivingtrap via TCP
>
>
>> Bill,
>>
>> Yes, of course. SNMP4J 1.6 RC1 will be released within the next 48
>> hours.
>> I will also try to provide this fix for v1.5.
>>
>> Best regards,
>> Frank
>>
>> Mccarty, William (Bill) wrote:
>>
>>> Frank,
>>>
>>> I tried this patch out and it appears to work.
>>>
>>> Will this be added into future releases of your package?
>>> Thanks again.
>>> Bill
>>> -----Original Message-----
>>> From: Frank Fock [mailto:fock at agentpp.com] Sent: Wednesday, October
>>> 12, 2005 2:49 PM
>>> To: Mccarty, William (Bill)
>>> Cc: snmp4j at agentpp.org
>>> Subject: Re: [SNMP4J] Getting IllegalBlockingModeException when
>>> receiving trap via TCP
>>>
>>> Bill,
>>>
>>> the following patch should fix the problem:
>>>
>>> --- src/org/snmp4j/transport/DefaultTcpTransportMapping.java 19
>>> Aug 2005 22:13:17 -0000 1.25
>>> +++ src/org/snmp4j/transport/DefaultTcpTransportMapping.java 12
>>> Oct 2005 17:51:00 -0000
>>> @@ -547,6 +547,7 @@
>>> // Accept the date request and send back the date
>>> string
>>> Socket s = nextReady.accept().socket();
>>> readChannel = s.getChannel();
>>> + readChannel.configureBlocking(false);
>>> readChannel.register(selector, SelectionKey.OP_READ);
>>>
>>> incomingAddress = new TcpAddress(s.getInetAddress(),
>>> s.getPort()); @@ -565,6 +566,7 @@
>>> SocketEntry entry = (SocketEntry) sk.attachment();
>>> SocketChannel sc = (SocketChannel) sk.channel();
>>> if (sc.finishConnect()) {
>>> + sc.configureBlocking(false);
>>> logger.debug("Connected to " +
>>> entry.getPeerAddress());
>>> // make sure conncetion is closed if not used for
>>> timeout
>>> // micro seconds
>>>
>>> Best regards,
>>> Frank
>>>
>>> Mccarty, William (Bill) wrote:
>>>
>>>
>>>> Frank,
>>>>
>>>> Thanks for your quick reply.
>>>> This is running on Windows XP Professional, with SP1.
>>>> The Java is Java(TM) 2 Runtime Environment, Standard Edition (build
>>>> 1.4.2_05-b04).
>>>>
>>>> Bill
>>>>
>>>> -----Original Message-----
>>>> From: Frank Fock [mailto:fock at agentpp.com]
>>>> Sent: Wednesday, October 12, 2005 9:26 AM
>>>> To: Mccarty, William (Bill)
>>>> Cc: snmp4j at agentpp.org
>>>> Subject: Re: [SNMP4J] Getting IllegalBlockingModeException when
>>>> receiving trap via TCP
>>>>
>>>> Hi Bill,
>>>>
>>>> Could you please tell us which operating system and Java runtime
>>>> version you are using? It seems that this error is platform specific.
>>>>
>>>> Thanks,
>>>> Frank
>>>>
>>>> Mccarty, William (Bill) wrote:
>>>>
>>>>
>>>>
>>>>> I am using snmp4j-1.5.1 and when I attempt to receive a trap with
>>>>> the API configured for TCP an IllegalBlockingModeException occurs.
>>>>> Below is
>>>>>
>>>>>
>>>>
>>>>
>>>>> the stack trace that is displayed.
>>>>>
>>>>> Listening on 0.0.0.0/1024
>>>>> java.nio.channels.IllegalBlockingModeException
>>>>> at java.nio.channels.spi.AbstractSelectableChannel.register(Unknown
>>>>> Source)
>>>>> at java.nio.channels.SelectableChannel.register(Unknown Source)
>>>>> at
>>>>> org.snmp4j.transport.DefaultTcpTransportMapping$ServerThread.run(Defau
>>>>>
>>>>> l
>>>>> t
>>>>> TcpTransportMapping.java:475)
>>>>>
>>>>> I first saw this exception in my application. So I tried running
>>>>> the console application included in the SNMP4J package and saw the
>>>>> same exception.
>>>>> Am I missing something? Or is this a bug in the API?
>>>>>
>>>>> Bill
>>>>> _______________________________________________
>>>>> 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
>>
>>
>> _______________________________________________
>> 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