SNMP Stack 5_1

uk.co.westhawk.snmp.stack
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.

Thanks to Josh Bers <jbers@bbn.com>

Since:
4_14
Version:
$Revision: 3.1 $ $Date: 2005/02/17 17:03:06 $
Author:
Birgit Arkesteijn

Field Summary
 
Fields inherited from class uk.co.westhawk.snmp.stack.Pdu
added, answered, context, encodedPacket, errind, errstat, msg_type, reqVarbinds, respVarbinds, snmpv3MsgId
 
Constructor Summary
MultiResponsePdu(SnmpContextBasisFace con)
          By default create a MultiResponsePdu that will wait for 3 seconds for responses to come in from multiple sources.
 
Method Summary
 int getNumResponses()
          Gets the number of responses so far received to this request.
 java.lang.String getSourceAgent()
          Gets the IP address of the host of the most recent response received.
protected  void tell_them()
          Lets the observers know which source we received a response from.
 java.lang.String toString()
          Prints out the list of received responses and their source IP addressses.
 
Methods inherited from class uk.co.westhawk.snmp.stack.Pdu
addOid, addOid, addOid, addOid, addOid, addToTrans, getContext, getErrorIndex, getErrorStatus, getErrorStatusString, getMsgType, getReqId, getRequestVarbinds, getResponseVarbinds, isExpectingResponse, isTimedOut, new_value, notifyObservers, printVars, send, send, send, sendme, setErrorIndex, setErrorStatus, setErrorStatus, setMsgType, setRetryIntervals, toString, waitForSelf
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

getSourceAgent

public java.lang.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 java.lang.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

tell_them

protected void tell_them()
Lets the observers know which source we received a response from.

Overrides:
tell_them in class Pdu

SNMP Stack 5_1