Dart SNMP Library 4.0
Start Method
Specifies the endpoint to receive SNMP messages on. If NULL/Nothing, the default IPv4 endpoint on port 161 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.
Set to false if broadcast packets should not be accepted. Default value is True.
Description
Open a UDP socket and listen for requests. The Request event is raised as each SNMP request is received.
Syntax
Visual Basic
Public Sub Start( _
   ByVal localEP As IPEndPoint, _
   Optional ByVal freeThreading As Boolean = False, _
   Optional ByVal acceptBroadcast As Boolean = True _
) 
Parameters
localEP
Specifies the endpoint to receive SNMP messages on. If NULL/Nothing, the default IPv4 endpoint on port 161 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.
acceptBroadcast
Set to false if broadcast packets should not be accepted. Default value is True.
Remarks

To get a list of possible physical local endpoints to bind to, use IPEndPointList.AddLocalAddresses to populate the IPEndPointList.

This method creates a worker thread that receives SNMP messages sent to the specified local endpoint. An IPv4 socket will only receive packets addressed to IPv4 sockets, just as an IPv6 socket will only receive IPv6 packets. Use multiple Agents to receive packets on multiple sockets.

ErrorLog and Request events are raised on the thread Start() was called on. The developer must implement message handling code in the body of the Request event to process SNMP messages, such as in the snippet below.

Close is used to disable communications and release the worker thread used to receive requests on.

Example
Demonstrates how to start an Agent listening for incoming requests on the specified local binding address, and how to respond to requests.
Private Sub StartAgent(localAddress As String)
    'Populate a variable on the agent
    Agent1.Variables.Add Agent1.Mib.Nodes("sysDescr").CreateVariable("System Description")
    'Establish local binding address
    Dim localEP As New IPEndPoint
    localEP.NameOrAddress = localAddress
    localEP.Port = 161
    'Start agent on the specified local binding address
    Agent1.Start localEP, True
End Sub

Private Sub Agent1_Request(ByVal requestMessage As DartSnmpCtl.ISnmpMessage)
    Agent1.SendResponse Agent1.CreateResponse(requestMessage), requestMessage.Origin
End Sub
See Also

Agent Object  | Agent Members


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