[SNMP4J] TcpAddress issue
joe.sulewski at L-3com.com
joe.sulewski at L-3com.com
Thu Apr 30 15:28:04 CEST 2015
Hello,
I'm trying to send data over TCP due to some parts of our network that have high unreliability. I'm using version 2.2.3 of the SNMP4J library and I'm getting an error trying to send over tcp.
I setup the TransportMapping like so:
TcpAddress address = new TcpAddress(Inet4Address.getByName(NetTools.getLocalIPAddress()),1161);
transport = new DefaultTcpTransportMapping(address);
SNMP4JSettings.setExtensibilityEnabled(false);
snmp = new Snmp(transport);
transport.listen();
To send data I perform the following:
snmpSettings.setSNMPPort(1161);
targetAddress = GenericAddress.parse("TCP:" + snmpSettings.getAddress() + "/" + snmpSettings.getSNMPPort());
target = new CommunityTarget();
target.setCommunity(new OctetString(snmpSettings.getCommunity()));
target.setAddress(targetAddress);
target.setRetries(snmpSettings.getRetries());
target.setTimeout(snmpSettings.getTimeout());
target.setVersion(SnmpConstants.version2c);
snmp.get(pdu, target);
The get throws the following error: Unsupported address class (transport mapping): org.snmp4j.smi.TcpAddress
When I run in the debugger I looked at the snmp variable and the snmp->messageDispatcher->transportMappings table is:
{class org.snmp4j.smi.TcpAddress=[org.snmp4j.transport.DefaultTcpTransportMapping at 969d5c]}
The SNMP object appears to be setup correctly but yet I get the unsupported address class. I must be missing something obvious
I appreciate any pointers.
Thanks,
Joe
More information about the SNMP4J
mailing list