[SNMP4J] Fwd: Port zero

Felix Kaiser felix.kaiser at fxkr.net
Fri Sep 6 16:11:14 CEST 2013


Hi,

looks like my previous email didn't get through.

Thanks for providing SNMP4J as free software!

Here are two small issues:

1. When binding a socket, port 0 means that a random free port is to be
selected. (Quite useful when spawning SNMP agents for automated integration
tests.) However, org.snmp4j.transport.UdpTransportMapping#getAddress /
#getListenAddress (side note: why have two methods?) will always return the
original UdpAddress with port 0, instead of getting the data from
socket.getLocalAddress()/.getLocalPort(). You can work around by
subclassing DefaultUdpTransportMapping and getting it directly from the
socket, of course, but...

2. In
org.snmp4j.transport.DefaultUdpTransportMapping#renewSocketAfterException
where you create new sockets, you only pass the port - you forgot to pass
the address...

Greetings
Felix



More information about the SNMP4J mailing list