Agent Object : Request Event |
Visual Basic |
---|
Public Event Request( _ ByVal requestMessage As SnmpMessage _ ) |
The developer must handle this event in their code (such as in the example below) for the Agent to respond to requests.
When SNMPv3 is used, the initial requests may not include an EngineId or time synchronization information. In this case a report PDU is automatically generated by CreateResponse and must be sent to enable subsequent authentication.
If CreateResponse does not produce the desired response, the response SnmpMessage may be manually generated.
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