public abstract class UdpTransportMapping extends AbstractTransportMapping<UdpAddress>
UdpTransportMapping
is the abstract base class for
UDP transport mappings.Modifier and Type | Field and Description |
---|---|
protected UdpAddress |
udpAddress |
asyncMsgProcessingSupported, maxInboundMessageSize, transportListener
Constructor and Description |
---|
UdpTransportMapping(UdpAddress udpAddress) |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes the transport an releases all bound resources synchronously.
|
UdpAddress |
getAddress()
Returns the transport address that is configured for this transport mapping for
sending and receiving messages.
|
UdpAddress |
getListenAddress()
Returns the address that represents the actual incoming address this transport
mapping uses to listen for incoming packets.
|
Class<? extends Address> |
getSupportedAddressClass()
Gets the
Address class that is supported by this transport mapping. |
abstract void |
listen()
Listen for incoming messages.
|
abstract void |
sendMessage(UdpAddress address,
byte[] message,
TransportStateReference tmStateReference)
Sends a message to the supplied address using this transport.
|
addTransportListener, fireProcessMessage, getMaxInboundMessageSize, isAsyncMsgProcessingSupported, removeTransportListener, setAsyncMsgProcessingSupported
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isListening
protected UdpAddress udpAddress
public UdpTransportMapping(UdpAddress udpAddress)
public Class<? extends Address> getSupportedAddressClass()
TransportMapping
Address
class that is supported by this transport mapping.getSupportedAddressClass
in interface TransportMapping<UdpAddress>
getSupportedAddressClass
in class AbstractTransportMapping<UdpAddress>
Address
.public UdpAddress getAddress()
Address
used by this transport mapping. The returned
instance must not be modified!public UdpAddress getListenAddress()
TransportMapping
null
this transport
mapping is not configured to listen for incoming packets.public abstract void listen() throws IOException
TransportMapping
TransportMapping.sendMessage(A, byte[], org.snmp4j.TransportStateReference)
is called for the
first time.listen
in interface TransportMapping<UdpAddress>
listen
in class AbstractTransportMapping<UdpAddress>
IOException
- if an IO operation exception occurs while starting the listener.public abstract void close() throws IOException
TransportMapping
close
in interface TransportMapping<UdpAddress>
close
in class AbstractTransportMapping<UdpAddress>
IOException
- if any IO operation for the close fails.public abstract void sendMessage(UdpAddress address, byte[] message, TransportStateReference tmStateReference) throws IOException
TransportMapping
sendMessage
in interface TransportMapping<UdpAddress>
sendMessage
in class AbstractTransportMapping<UdpAddress>
address
- an Address
instance denoting the target address.message
- the whole message as an array of bytes.tmStateReference
- the (optional) transport model state reference as defined by
RFC 5590 section 6.1.IOException
- if any underlying IO operation fails.Copyright © 2020 SNMP4J.org. All rights reserved.