PowerSNMP for .NET | SNMP Manager Code Example

See all PowerSNMP for .NET Code Examples

SNMP Manager Example

This example demonstrates initiating a Manager and listening for and responding to SNMP queries (Traps and Informs).

 

private void Form_Load(object sender, EventArgs e)
{
     Manager manager1 = new Manager();
     //Start listening
     manager1.Start(manager1_NotificationReceived, null);
}

private void manager1_NotificationReceived(Manager manager, MessageBase message, object state)
{
     //Handle informs
     if (message is InformMessage)
     {
          //Send response to inform message origin
          manager.Send(new ResponseMessage(message as InformMessage, null), message.Origin);
     }

     //Display Trap or Inform content
     Console.WriteLine(message.ToString());
}

 

To download a trial please visit the PowerSNMP for .NET product page.