Dart SNMP Library 4.0
GetResponse Method
Request to send to the specified SNMP entity.
Target address.
The local network interface to bind to for the operation. Can be NULL/Nothing.
Optional timeout period in milliseconds. Defaults to 1000 when unspecified.
The number of retries that should be attempted before failing with a timeout error.
The threading model the control will use when executing this method.
Object to pass to the Response event; can be NULL/Nothing.
Description
Send a request and receive the response.
Syntax
Visual Basic
Public Function GetResponse( _
   ByVal requestMessage As SnmpMessage, _
   ByVal targetEP As IPEndPoint, _
   ByVal localEP As IPEndPoint, _
   Optional ByVal timeout As Integer = 1000, _
   Optional ByVal retries As Integer = 2, _
   Optional ByVal threading As ThreadingConstants = threadingBlock, _
   Optional ByVal userState As Variant _
) As SnmpMessage
Parameters
requestMessage
Request to send to the specified SNMP entity.
targetEP
Target address.
localEP
The local network interface to bind to for the operation. Can be NULL/Nothing.
timeout
Optional timeout period in milliseconds. Defaults to 1000 when unspecified.
retries
The number of retries that should be attempted before failing with a timeout error.
threading
ValueDescription
threadingAsyncImplements Apartment Model threading without method blocking.
threadingBlockImplements Apartment Model threading with method blocking (UI messages are processed).
threadingFreeImplements Free Model threading with method blocking (UI messages are not processed).
The threading model the control will use when executing this method.
userState
Object to pass to the Response event; can be NULL/Nothing.
Return Value
An SnmpMessage containing the response (if threading is threadingBlock or threadingFree), or NULL/Nothing if threading is threadingAsync.
Remarks

A new socket is created and used each time this method executes.

If localEP is specified, the socket is bound to the specified address family, address and port for the operation. If NULL/Nothing, a socket is created that uses a compatible 'Any' local interface and an ephemeral port.

When used asynchronously (threading is threadingAsync), the Response event will be raised providing access to the response after it has been received, and the Error event will be raised if any error occurs.

Example
Demonstrates retrieving the value of an OID.
Private Function GetSysDescr(agentEP As IPEndPoint, version As Integer, snmpUser As User) As String
    Dim msg As New SnmpMessage
    msg.community = "public"
    
    msg.Variables.Add Manager1.Mib.Nodes.Item("sysDescr").CreateVariable()
    
    If version = 1 Then
        msg.Type = PduConstants.pduGet1
    ElseIf version = 2 Then
        msg.Type = PduConstants.pduGet2
    Else
        msg.Type = PduConstants.pduGet3
        msg.Security.User = snmpUser
    End If
    
    Dim response As SnmpMessage
    Set response = Manager1.GetResponse(msg, agentEP, Nothing)
    GetSysDescr = response.Variables(0).ValueAsString
End Function
See Also

Manager Object  | Manager Members


PowerSNMP for ActiveX Documentation Version 4.0
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic