SNMP++ Non-Default Port Number Connections

Hi,

snmp++ does not have any special restrictions on the ports. You could use the snmpNext example to access the device. If SNMPv1 with public community is configured, the command “./snmpNext 1.2.3.4 -P501” should work.

Some more details:

  • When constructing a Snmp object, you should pass “0” as the port number, so a (random) free client port will be used. This is OK for your use case, as this port is used as the source port for the communication to the device.
  • To access a device that listens on port 501 you have to create a SnmpTarget (either CTarget or UTarget) object with a UdpAddress that has been set to the port 501.

You should easily find the relevant code in the snmpNext.cpp example.

Regards,
Jochen