Dart SNMP Library 4.0
Start Method
Specifies the endpoint to receive messages on. If NULL/Nothing, the default IPv4 endpoint on port 162 will be used.
Specifies whether events should be raised on a worker thread. Use true when in environments without a message pump, such as console or service applications.
Description
Open a UDP socket and listen for messages. The Inform or Trap event will be raised for each SNMP inform request or trap received, respectively.
Syntax
Visual Basic
Public Sub Start( _
   ByVal localEP As IPEndPoint, _
   Optional ByVal freeThreading As Boolean = False _
) 
Parameters
localEP
Specifies the endpoint to receive messages on. If NULL/Nothing, the default IPv4 endpoint on port 162 will be used.
freeThreading
Specifies whether events should be raised on a worker thread. Use true when in environments without a message pump, such as console or service applications.
Remarks

This method opens a socket and starts listening for traps and inform requests. To get a list of possible physical local endpoints to bind to, use IPEndPointList.AddLocalAddresses to populate the IPEndPointList.

If a socket is already open, it will be closed and reopened on localEP.

Once started, the ErrorLogTrap and Inform events will be raised appropriately.

Use Close to disable communications.

Example
Demonstrates receiving notifications (Trap1, Trap2 and Inform messages), and responding to Inform messages.
Private Sub StartManager(localAddress As String)
    Dim localEP As New IPEndPoint
    localEP.NameOrAddress = localAddress
    localEP.Port = 162
    Manager1.Start localEP
End Sub

Private Sub Manager1_Trap(ByVal trapMessage As DartSnmpCtl.ISnmpMessage)
    'Process trap as needed here, or display:
    Text1.Text = Text1.Text + trapMessage.ToString + vbCrLf
End Sub

Private Sub Manager1_Inform(ByVal informMessage As DartSnmpCtl.ISnmpMessage)
    ' Inform message has arrived. Send back a response (acknowlegement)
    Dim message As SnmpMessage
    Set message = Manager1.CreateInformResponse(informMessage)
    Manager1.SendResponse message, informMessage.Origin
    
    'Update UI as needed
    Text1.Text = Text1.Text + "Manager received inform:" + vbCrLf + informMessage.ToString + vbCrLf
End Sub
See Also

Manager Object  | Manager Members


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