Package org.snmp4j.transport


package org.snmp4j.transport
Provides transport protocol mappings for SNMP.

The org.snmp4j.transport classes are capable of sending and receiving byte messages to and from a network using transport mapping specific transport protocol. All SNMP4J transport mappings have to implement the org.snmp4j.TransportMapping interface. SNMP4J supports two transport mappings for the transport protocols UDP and TCP:

  • The UDP transport mapping is the default SNMP transport mapping. It is implemented by the DefaultUdpTransportMapping class.
  • The TCP transport mapping is implemented by the DefaultTcpTransportMapping using the java.nio package.

Additional transport mappings can be easily added. It is sufficient to implement the org.snmp4j.TransportMapping interface and add an instance of that class to the Snmp (or MessageDispatcher) object. To be able to lookup a transport mapping by an Address class via the TransportMappings (as Snmp does for notification listeners), a transport mapping has to be registered in a transport mapping registration file. The default file is transports.properties in the org.snmp4j.transport package. To use a different file, set the system property org.snmp4j.transportMappings.

Connection-oriented transport mappings like TCP should implement the ConnectionOrientedTransportMapping interface to support MessageLengthDecoder and TransportStateListener.

The following UML class diagram shows the classes of the org.snmp4j.transport package and their relationships (relationships to other packages are not shown):

UML Class Diagram org.snmp4j.transport