We would like to change SNMP4J version from 2.5.3 to 3.3.1, but we encountered following problem in trap receiving area. We use trap processing in 2 ways:
- full processing done by SNMP4J (using following interface: org.snmp4j.CommandResponder#processPdu)
- forwarding original trap to external system (using following interface: org.snmp4j.transport.TransportListener#processMessage)
We have a problem in second use case - in our scenario we take original message (provided via org.snmp4j.transport.TransportListener#processMessage) and forward it using Datagram to defined address. And we got following errors:
- java.net.SocketException: The message is larger than the maximum supported by the underlying transport: Datagram send failed
- or java.io.IOException: Message too long
The reason of that is that in version 3.3.1 you invoke “processMessage” always with full length buffer (org.snmp4j.transport.AbstractTransportMapping#maxInboundMessageSize -> 65535) containing the original version of message (doesn’t matter what is the length of this message). In our case this buffer is too big to send it again as datagram message because max value for data in UDP is 65,507 bytes.
In 2.5.3 you provided buffer with original message length.
- is it possible to add original message length in org.snmp4j.transport.TransportListener#processMessage?
- is there any other way to get original message length?
- is there any other way to take original trap?
I know that we can send message with the max value of 65507 bytes but I think it is not a good approach when typical UDP messages are much smaller.
Looking forward for any hints. Thank you.