Make SNMP Request
Namespace: SnmpSharpNetAssembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.9.1.0 (0.9.1)
Syntax
| C# |
|---|
public SnmpPacket Request( Pdu pdu, IAgentParameters agentParameters ) |
| Visual Basic |
|---|
Public Function Request ( _ pdu As Pdu, _ agentParameters As IAgentParameters _ ) As SnmpPacket |
| Visual C++ |
|---|
public: SnmpPacket^ Request( Pdu^ pdu, IAgentParameters^ agentParameters ) |
Parameters
- pdu
- Type: SnmpSharpNet..::..Pdu
Pdu class (do not pass ScopedPdu)
- agentParameters
- Type: SnmpSharpNet..::..IAgentParameters
Security information for the request. Use AgentParameters for SNMP versions 1 and 2 requests. Use SecureAgentParameters for SNMP version 3 requests.
Return Value
Appropriate SNMP packet class for the reply received (SnmpV1Packet, SnmpV2Packet, or SnmpV3Packet. Null value if there was an error with the request.
Remarks
Make SNMP request. With this method you can make blocked SNMP version 1, 2 and 3 requests of type GET,
GET-NEXT, GET-BULK, SET and REPORT (request types have to compatible with the SNMP protocol version you
are using).
This method will pass through any exceptions thrown by parsing classes/methods so see individual packet
classes, ASN.1 type classes, authentication, privacy, etc. classes for exceptions thrown.
Exceptions
| Exception | Condition |
|---|---|
| SnmpSharpNet..::..SnmpAuthenticationException | Thrown on SNMPv3 requests when authentication password is not specified on authNoPriv or authPriv requests in SecureAgentParameters or if incoming packet authentication check failed. With SNMP ver1 and ver2c, authentication check fails when invalid community name is parsed in the reply. |
| SnmpSharpNet..::..SnmpPrivacyException | Thrown on SNMPv3 requests when privacy password is not specified in SecureAgentParameters on authPriv requests. |
| SnmpSharpNet..::..SnmpException | Thrown in following cases: * IAgentParameters.Valid() returned false. SnmpException.ErrorCode is set to SnmpException.InvalidIAgentParameters * No data received on request. SnmpException.ErrorCode is set to SnmpException.NoDataReceived * Invalid RequestId in reply. SnmpException.ErrorCode is set to SnmpException.InvalidRequestId |