[SNMP4J] Getting IllegalBlockingModeException when receiving trap via TCP
Frank Fock
fock at agentpp.com
Thu Oct 13 08:50:38 CEST 2005
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
More information about the SNMP4J
mailing list