Class MultiResponsePdu

java.lang.Object
java.util.Observable
uk.co.westhawk.snmp.stack.Pdu
uk.co.westhawk.snmp.stack.MultiResponsePdu

public class MultiResponsePdu extends Pdu
This class can receive multiple responses. Typical usage includes sending a single PDU to a multicast / broadcast address so that multiple responses can be received from different sources.

This class sets a single long timeout for the retry, so it sends the request only once. Opposite to its parent class, this class does not ignore the duplicate responses, and it will timeout by nature.

Note:

  • Please realise that you might choke the stack and your network, when you use this class, even on a small subnet
  • This PDU will eat up transmit and receive resources, until it times out
  • This PDU cannot be used to receive traps
  • Authentication (and privacy) is by definition a unicast activity. You can find unauthenticated SNMPv3 engines, by broadcasting this PDU with a SnmpContextv3(Pool) with no authentication. Then you need to continue an authentication/privacy context and a (normal) PDU.
    In other words, finding SNMPv3 engines that only support authentication and/or privacy cannot be done via broadcasting.

Thanks to Josh Bers <jbers@bbn.com>

Since:
4_14
Version:
$Revision: 3.3 $ $Date: 2007/10/17 10:44:09 $
Author:
Birgit Arkesteijn
  • Constructor Details

    • MultiResponsePdu

      public MultiResponsePdu(SnmpContextBasisFace con)
      By default create a MultiResponsePdu that will wait for 3 seconds for responses to come in from multiple sources. If you want to wait longer set the RetryInterval to a longer first timeout. To make the request more reliable, add more timeouts.
      Parameters:
      con - The context
  • Method Details

    • getSourceAgent

      public String getSourceAgent()
      Gets the IP address of the host of the most recent response received.
      Returns:
      The sourceAgent value
    • getNumResponses

      public int getNumResponses()
      Gets the number of responses so far received to this request.
      Returns:
      The number of responses
    • toString

      public String toString()
      Prints out the list of received responses and their source IP addressses. Results will be ommitted if not yet received.
      Overrides:
      toString in class Pdu
      Returns:
      String representation of this PDU and all its received responses