PowerSNMP for .NET

from $1,199.00
Available Platforms

A Superior SNMP .NET Class Library

Simple Network Management Protocol (SNMP) components seamlessly integrate threaded communications, security, and encoding/decoding so you can quickly develop custom SNMP applications. This development tool requires fewer resources, provides more flexibility, and elicits code that is easy to re-use and maintain. See our Programming Primer for detailed instructions.


Why buy a component when Open Source C# libraries are just a click away (#SNMP and SNMP Sharp Net)?

  • Open Source documentation and sample projects are very limited, so SNMP novices need not apply
  • they are not organized as agent and manager classes, so you have to figure out how to put the pieces together
  • advanced features like MIB parsing and SNMPv3 engine caching are missing
  • why risk the success of your project on "free" software that's likely to cost you days of research, excessive code writing and unnecessary testing?

 

Consulting and Custom Development

From MIB creation to complete SNMP systems, let our experienced staff help with your SNMP project.

 

Manage network devices and remote information

  • Manager component receives and decodes Trap and Inform messages
  • Enhanced with .NET 4.5 asynchronous task support for requesting and retrieving management information from Agents
  • Superior scaling in high-throughput environments
  • Discover agents and query their information base (variables)
  • Get an entire table with a single method (supports sparse tables)
  • Communicate with agents in parallel (on multiple threads) or serially (on a single thread)
  • Send Inform messages to other managers
More...


     

    Respond to SNMP requests and send notifications

    • Agent component receives, decodes and responds to Get, GetBulk, Set requests
    • Create and send Trap and Inform messages
    • Create default responses from requests or build your own
    • Automatically updates agent variables and tables
    More...

     

    Use standard and custom MIBs

    • Load and parse MIB files at design-time or run-time
    • MibNode definitions use OIDs to associate MIB file definitions with variable IIDs found in PDUs
    • Intrinsic support provided for standard SNMPv2 SMI MIBs
    • TreeView can be populated with parsed MIBs for easy viewing
    More...

     

    Comprehensive Security

    • Security class provides seamless SNMPv3 integration
    • MD5, SHA authentication support
    • DES, Triple DES, AES128, AES192, AES256 encryption support

    More...

     

    Interoperability

    • Compatible with CISCO, MG-Soft , NET-SNMP and other SNMP software
    • Compatible with FIPS 140-2 standards
    • Complies with SNMP RFCs for version 1 (1155, 1156, 1157, 1212, 1213, 1215, 2863, 3418), version 2 (1901, 1907, 1908, 3416, 3417), and version 3 (3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3584, 3826, 5343)

     

    Need a free SNMP Manager Application?

    PowerSNMP Free Manager is an easy-to-use Windows Forms application built using PowerSNMP for .NET. Complete source code included with PowerSNMP for .NET.
    Download PowerSNMP Free Manager >

     

    Included With SNMP for .NET

    Component Description
    Manager Component Catches traps and informs, queries SNMP Agents and informs other SNMP Managers.
    Agent Component Responds to SNMP manager requests, sends traps and informs.

     

    • Manager and Agent drag and drop components provide UDP transport for SNMP messages
    • SnmpSocket class provides high-performance multi-threaded request-response communications
    • MibNodes class provides MIB file loading and parsing, as well as MibNode definitions
    • Specialized Message classes (GetMessage, GetNextMessage, etc.) provide message encoding, decoding and security
    • MIB parser creates dynamic MibNode definition objects from MIB files
    • Sample projects for C#, VB.NET, C++/CLI, ASP.NET, PowerShell
    • Comprehensive MS Help 2.0 and MS Help Viewer integrated documentation
    • Stand-alone and online documentation also included
    • Free email support and binary updates during subscription period

     

    Supported Environments

    PowerSNMP for .NET supports .NET Framework version 4.0+ and .NET Core 2.0.

    PowerSNMP for .NET can be used with any .NET compliant language:

    • C#
    • VB.NET
    • Managed C++
    • Powershell

     

    PowerSNMP for .NET 4.x components have been tested in the following application environments:

    • Windows forms desktop applications
    • Windows console applications
    • Windows ASP.NET web applications and Web Sites
    • Windows service applications
    • Windows web service applications
    • Windows .NET Framework 4 Client Profile
    • Windows Presentation Foundation (WPF) applications

     

    PowerSNMP for .NET 4.x components have been tested in the following development environments:

    • Visual Studio .NET (2010, 2012, 2013, 2015, 2017)
    • Mono platform 2.10 and 3.12 

     

    .NET Standard 2.0 supported platforms: https://docs.microsoft.com/en-us/dotnet/standard/net-standard

     

     

       

      PowerSNMP for .NET components do not currently support execution within Silverlight. If you are interested in using Dart products within your Silverlight solution, contact support@dart.com for more options. 

       

      New Sample Projects have been added to include .NET Core 2.0 projects, referencing the Dart.Snmp.Standard dll. Look for the  to identify these samples.

       

      Code Examples

      These code snippets can be copied and pasted into your project.

       

      General Examples 

      Code Snippet Description
      Non-blocking Operation Illustrates how Dart's FTP components can be used to stream multiple files over the network.
      Logging Requests Accepts passive connections and echoes back all data it receives over those connections.
      Logging Messages Allows you to send a receive files between a remote computer.
      Sending Informs Demonstrates the mechanics of connecting to an HTTP server, and sending/receiving resources from the server.
      Sending SNMPv3 Requests Demonstrates how to make a TCP control listen for and accept HTTP requests.
      Adding SNMPv3 users Demonstrates retrieval of mail from a POP3 mail server.

       

       

      Agent Examples 

      Code Snippet Description
      Basic Agent Operation Starting an agent that receives and responds to SNMP queries (sets, gets, etc)
      Adding Variables to the Agent Adding variables to an agent's Variables collection
      Responding to Requests Responding to a Get request for a value maintained outside of Agent.Variables
      Populating a Table Populating a specific table with a pre-defined method
      Populating a Table from an Array Populating an arbitrary table from a 2d string array on a local agent
      Sending Traps Sending Traps
      Sending MIB Defined Traps Sending a Trap defined in a loaded MIB

       

       

      Manager Examples

      Code Snippet Description
      Listening for Notifications Listening for notifications (traps and informs), and responding to informs
      Sending a Get Request Sending a Get request and receiving the response
      Sending a Set Request Sending a Set request and receiving the response
      Get Request Using MibNodes Sending a Get request for an object defined in a MIB loaded at runtime
      Get Request Using Mib Code Files Sending a Get request for an object defined in a Mib code file
      Single-threaded Get Requests Sending a Get request in a single-threaded application (demonstrates basics of single-threaded use)
      Discovering Agents Discovering agents on your network with a broadcast Get request
      Sending GetNext Requests Sending a GetNext request and receiving the response
      Sending GetBulk Requests Sending a GetBulk request and receiving the response
      GetTable Using GetNext Requests Getting an SNMP table using the GetTable method utilizing GetNext requests
      GetTable Using GetBulk Requests Getting an SNMP table using the GetTable method utilizing GetBulk requests
      Populating a Table Remotely Populating an arbitrary table from a 2d string array on a remote agent from a manager
      Walk an Agent Walking an agent from a specified OID
      Manually Walk an Agent Manually walk an agent using GetNext requests

       

       

      Sample Projects

      Samples are working applications demonstrating SNMP for .NET components in C#, VB.NET, C++/CLI and PowerShell. Source code included. 

       

      Sample Name Sample Description
      Agent Demonstrates responding to SNMP requests and sending rap and inform messages.
      Manager Demonstrates getting and setting Agent variables, sending and receiving inform messages, retrieving tables, and receiving traps.
      Manager Task Async Uses the Manager Component to build a simple manager. Supports queries for basic variables, either by discovery or specific address. Also shows how to set values. Uses GetResponseTaskAsync to retrieve variable values and send informs.
      Trap Catcher Demonstrates receiving and processing trap messages.
      MIB Treeview Demonstrates displaying mibs in a tree structure and on-demand mib parsing. Also demonstrates mib compilation into code files.
      MIB Walker Demonstrates discovering and retrieving variables supported by an agent under a specified OID.
      SNMP Poll Demonstrates simultaneous high-performance polling of numerous variables.
      Web Manager (ASP.NET) Demonstrates getting Agent variable values in a web application.
      Web Service Manager Demonstrates getting Agent variable values in a web service application. Includes example consumer app.
      WCF Service Manager Demonstrates getting Agent variable values in a Windows Communication Foundation (WCF) service application. Includes example consumer app.
      WPF Simple Manager Demonstrates using the Manager component to build a simple manager in WPF
      Agent Console  Demonstrates a simple blocking Agent in a console application.
      Trap Console  Demonstrates a simple blocking trap catcher using the Manager component in a console application.
      Manager Console  Demonstrates performing a simple blocking get using the Manager component within a console application.
      Agent Service Uses the Agent Component to build an agent as a windows service.
      Trap Service Demonstrates a simple trap catcher using the Manager component in a windows service.

       

       

      Application Projects

      Applications are more sophisticated than samples and demonstrate more comprehensive functionality. 

      Application Name Application Description
      Free SNMP Manager Demonstrates a fully functional SNMP Manager application. WinForms C# source.

       

      Product Release History

      The following is a list of public releases for all components shipped with PowerSNMP for .NET (Latest Release 2018-03-21)

       

      PowerSNMP for .NET

      Current Version: 4.10.0.1

       

      4.10.0.1 Released: 2018-03-21



      • Support for FIPS complaint AES encryption.
      • Developer Note: The ReportType.BadPrivacyPassword and ReportType.MissingUserCredentials enumerations have been removed. Exceptions are now thrown in their place.

       

      Product fixes in this release:

      • Resolved an issue where a malformed SNMP message could result in a null reference exception being thrown. (1029)

       

       

      4.9.5.8 Released: 2018-02-22


       

      • Added support for .NET Standard 2.0 and .NET Core 2.0
      • New .NET Core 2.0 sample projects, referencing the Dart.Snmp.Standard dll
      • Updated trial license operation for use on .NET Standard-compatible platforms
        - Details regarding trial operation for Dart.Snmp.Standard.dll can be found in the Licensing and Trial Operation topic in the included help documentation

       

       

      4.9.4.1 Released: 2017-03-30


       

      Product fixes in this release:

      • An issue involving SNMPv3 communications was unintentionally introduced with the release of version 4.9.0.1. With the release of this version, encryption keys were not being cached and therefore regenerated each time they were needed, causing delays. (TFS1005) This has now been addressed. (TFS1005)

       

       

      4.9.3.0 Released: 2017-03-08


       

      • Visual Studio 2017 compatibility.

       

       

      4.9.2.0 Released: 2016-10-12


       

      The following variable methods have been added to the VariableCollection collection to provide more convenient access to items within the collection:

      • GetByNodeName
        - GetByName
        - GetByOid
        - GetByMibNode
      • Engine.Clone, TrapUserList.Clone, and User.Clone methods were added.

       

       

      4.9.1.0 Released: 2016-08-15


       

      • A minor compatibility change was made to allow messages that tag TimeTicks as Integer to be decoded.

       

      Product fixes in this release:

      • Displayhint is now correctly inherited from base MIB node definitions. (939)
      • linkDown, linkUp, and egpNeighborLoss have been added to the default notification node list. (943)

       

       

      4.9.0.1 Released: 2016-05-10


       

      • XML serialization support has been added to the SNMP message classes.
      • Dual Mode (simultaneous IPv6 and IPv4) sockets are now supported on compatible operating systems. (Vista+)
      • Compatibility with third-party SNMP agents and managers has been improved.

       

      Product fixes in this release:

      • SNMP message classes will provide correct licensing instructions, when used without a manager or agent component. (676)
      • An issue with AES initialization has been addressed. (821)
      • A compatibility issue involving CISCO SNMP entities, using AES-192 and AES-256 bit encryption, has been resolved. (825)

       

       

      4.8.1.0 Released: 2015-04-09


       

      Product fixes in this release:

      • The MibNodes.GenerateCode() method no longer throws an erroneous ArgumentException. (663)

       

       

      4.8.0.3 Released: 2015-03-16


       

      Detailed Release Notes

       


      Product fixes in this release:

      • Importing Mibs containing nodes with the same name as default nodes will now work correctly. Nodes with names that match a default node's name will now be renamed with a trailing underscore. (553)
      • The Manager component could throw an "IndexOutOfRange" exception if the OIDs attached to a variable were different from the expected. This can occur for agents that incorrectly return 0.0 as the OID for uninitialized variables instead of the appropriate error report. (566)
      • An issue where the ErrorIndex property could be incorrectly populated was resolved. (580)
      • Unsigned32 is no longer downgraded to SimpleType.UInteger when parsing MIBs, and UInteger32 is now correctly parsed to SimpleType.UInteger. Unsigned32 variables in received messages are now decoded to SimpleType.Gauge as they share an APPLICATION tag value. When creating a Variable for an Unsigned32 type, use Gauge. (583, 588)
      • Variable IDs on received requests are no longer assumed to be OIDs. Variable.Definition for received messages now populates with the correct MibNode. (587)
      • When using the Variable(MibNode definition) constructor, the Variable.Id generated will now only end in '.0' if Definition.Usage type is Usage.Object. (596)
      • Resolved an issue where exceptions could be thrown but not caught with heavy use of asynchronous operations. (597)
      • AuthoritativeEngine.Boots is now initialized to 1, and incremented when AuthoritativeEngine.Time reaches Int32.MaxValue. If a different value is desired under other circumstances, it must be set by the application. (605, 606)

       

       

      4.7.0.1 Released: 2014-07-23


       

       

      Product fixes in this release:

      • Improved parsing of MIB definitions when they are loaded out of order. (261, 307)
      • The Agent component no longer throw an ArgumentOutOfRangeException when a .iso variable is used with a GetNextMessage. (317)
      • Calling Message.ToString() will no longer throw an exception if the message has not been sent previously. (382)
      • An inherited MibNode will use the parent's display hint if the MibNode does not define its own. (384)
      • Variables that can be created and are in the Agent's MibNodes collection but not in the Agent's variable collection will now be created if a Set message is received. (412)
      • If an agent receives a trap the RequestReceived event will no longer be raised and the Log event will be raised instead. (420)
      • Thread safe collections are now used where thread collisions are of concern. (435)
      • Removed a call to DoEvents during Mib parsing to allow parsing in environments that do not have access to the System.Windows.Forms namespace. (436)
      • Counter, Gauge, TimeTicks and Uinteger will now serialize and deserialize correctly. (437)
      • GetBulkMessage will only return variables up to the end of the MibView when repetitions exceed the number of variables available. (512)
      • The Agent component's SysUpTime property is no longer part of the component's designer interface. (526)
      • Single line enumerated TEXTUAL-CONVENTIONS are now parsed correctly. (527)
      • Resolved an issue where the Manager component's Mib importer form would intermittently fail to load. (530)

       

       

      4.6.1.0 Released: 2014-01-14


       

      Product fixes in this release:

      • An intermittent failure with encrypting PDU's using AES was fixed. (380)

       

       

      4.6.0.1 Released: 2013-11-15


       

      • Dart Communications is pleased to announce the release of PowerSNMP for .NET 4.6.

       

      Some of the new features include:

      • Added the ability to send traps from an Agent instance without opening the Agent first.
      • Support for sending Informs from Agent to Manager added.
      • Log event added to the Agent.
      • Better support for script based environments such as PowerShell.
      • Message decoding has been relaxed to provide a decoded message whenever possible.
      • A Message.Authenticate property has been added to SNMPV3 message classes to indicate whether a message has failed authentication or not.

       

      Some interface changes were necessary to accommodate the new features and performance enhancements. We have made an upgrade guide available to assist in migrating to the new version:

      PowerSNMP for .NET 4.6 Upgrade guide

      Please contact us with any questions or concerns about migration at support@dart.com.

      • Trial operation has changed. In addition to the existing 7-day runtime trial license, a 30-day development trial license will also be enforced.

       

      Product fixes in this release:

      • Previously removed Send and Receive methods on ManagerSlave have been restored. Note that the ManagerSlave class has been renamed to SnmpSocket. (TFS198)
      • VariableList now supports identifiers equal to the max value of 32 bit unsigned integer. (TFS286)
      • Trial notifications have been revamped to be more friendly with service based projects. (TFS294)
      • Improved SNMP message handling so that all responses and unsolicited messages received are paired or reported correctly. (TFS314)

       

       

      4.5.2.1 Released: 2012-10-23


       

      • Trial licensing operation updated.

       

       

      4.5.1.2 Released: 2012-10-18


       

      • Updated for Visual Studio 2012 integration and Windows 8 compatibility.

       

      Product fixes in this release:

      • Addressed an issue where the Load Mib dialog would not display in the designer under Visual Studio 2012 and .NET 4.5. (TFS37)

       

       

      4.5.0.0 Released: 2012-08-09


       

      Product fixes in this release:

      • Added the ToArray method to the SimpleTaggedType class to simplify retrieving a variable's value as a byte array. (5630)
      • Added support for decoding message variables when an incorrect variable sequence length is specified. (5639)
      • Fixed a mib parsing error that would occur if blank lines are present in a mib file after DESCRIPTION and REFERENCE declarations. (TFS19)
      • Fixed a mib parsing error that would occur if a duplicate name was present in the mib file. (TFS25)
      • Addressed a globalization issue that prevented correct operation for systems using the following language cultures: Azeri (az), Azeri-Latin (az-Latn), Azeri-Latin-Azerbaijan (az-Latn-AZ), Turkish (tr), Turkish-Turkey (tr-TR) (TFS31)

       

       

      4.4.4.2 Released: 2012-07-12


       

      Product fixes in this release:

      • Fixed a licensing issue with web service applications.
      • Updated the title bar of licensing messages to not indicate a product is in trial when it is licensed.

       

       

      4.4.3.0 Released: 2012-06-27


       

      • Updated trial operation behavior and removed obstacle to using product in .NET Framework 4.5.
      • Added a ToArray function to objects that derive from SimpleTaggedType.
      • Updated decoding to be more forgiving of messages containing incorrect variable sequence lengths.

       

       

      4.4.2.3 Released: 2012-04-13


       

      Product fixes in this release:

      • It is no longer necessary to add a v3 User to an AgentEngine prior to sending a v3 request to that User.
      • Fixed a mib parsing problem - a space is no longer necessary between a syntax type and subtype. (5617)
      • Fixed a mib parsing problem - blank lines are now ok after REFERENCE and DESCRIPTION properties. (tfs19)

       

       

      4.4.1.3 Released: 2012-03-14


       

      • Increased the performance of sending and receiving SNMP v3 requests and responses. (5614)

       

      Product fixes in this release:

      • Fixed problem with Display-String when converting bytes to decimal or octal values.
      • Fixed mib parsing problem that would occur when an object with a non-unique name was parsed before its ancestors. (5582)
      • Fixed problem with the Display-String parsing algorithm. (5591)
      • Fixed problem with the built-in "mib-2" branch in the mib tree. (5601)

       

       

      4.4.0.1 Released: 2011-10-20


       

      • Added new samples for Web Services and Windows Communication Foundation (WCF).
      • Added Windows Presentation Foundation versions of the Manager and Agent samples.
      • Added a new Walk method for easily walking a branch of an agent's MIB tree.
      • Added a VariableList.Populate method for displaying variables in a Treeview control.
      • Added SimpleType.ToString overload for displaying variable values using a provided DISPLAY-HINT.
      • Added MIB Import support to the Agent component designer.
      • Added an IsActive property to the Agent and Manager components.
      • Added a retries parameter to the GetTable functions, for agents that do not reply to requests in a timely manner.

       

      Product fixes in this release:

      • Variables can now be created with OIDs that contain very large octets (greater than 2^32). (5442)
      • The Manager component now gracefully handles v3 agent discovery with an agent that responds to all requests with an invalid Engine ID report containing the wrong Engine ID. (5488)
      • The agent no longer responds to v3 requests containing the correct Username but no password(s). (5508)
      • The MIB parser now handles Tables and Table Entries whose names do not end in "Table" and "Entry" respectively. (5515)
      • Fixed an issue that prevented SNMP for .NET from being used in Debian hosted MONO. (5516)
      • The GetTable functions no longer balk on tables with indexers that span multiple octets. (5531)
      • MIB definition names with dashes will now result in generated code that is compilable. (5534)
      • CreateDefaultResponse now uses the passed in request's Community instead of always using "public." (5539)

       

       

      4.3.1.0 Released: 2011-02-02


       

      • Replaced the static CreateEndPoint function with an IPEndPoint class derived from System.Net.IPEndPoint.

       

      Product fixes in this release:

      • Addressed a memory leak in the agent when receiving requests, and the manager when receiving traps. (5396)

       

       

      4.3.0.3 Released: 2010-12-13


       

      • The Agent and Manager components have been updated to utilize IO completion threads when listening for traps, notifications, informs and requests.
      • Support for IPv6 has been enhanced. A new CreateEndPoint function has been added to the Agent and Manager components. This method provides an easy way to create an IPv4 or IPv6 endpoint from a string host name (or address) and port. Method calls have been streamlined with IPEndPoint parameters.
      • "Agent discovery" using Manager.GetResponses now works for SNMPv3. The returned ResponseMessage array will contain ResponseMessages for agents that support the specified user, and ReportMessages for agents that do not.
      • Manager.GetResponses will now "broadcast" in IPv6 using the known "FF02::1" multicast group address.
      • Agents now include the option of NOT responding to broadcasted requests. Also, agents will now join the known "FF02::1" multicast group if the broadcast option is true and the agent opens on an IPv6 socket.
      • Variable.ValueName is now writable. Set this property to an enumerated value and the Variable.Value property will update to the correct integer value.
      • A Manager.Log event has been added that is raised whenever an SNMP message is sent or received.

       

      Product fixes in this release:

      • Fixed problem with creating Manager event handler functions from the designer. The first handler would appear as expected, but subsequent handlers would not appear until event handlers from any other class were added.
      • Replaced derived EventHandler classes and specialized delegates with generic event handlers. The designer will automatically use the new technique when creating and wiring the handler, but changes must be made to existing code. For example:
      • OLD: this.manager1.Message += new Dart.Snmp.MessageEventHandler(this.manager1_Message);
      • NEW: this.manager1.Message += new EventHandler<MessageEventArgs>(this.manager1_Message);
      • Manager.GetResponses will no longer throw any exceptions, as intended. DecodingExceptions will raise the Error event. (5205)
      • Message Create method will now accept a mib parameter of null. (5312)
      • Fixed manager handling of AuthoritativeEngines. First, the Manager.AuthoritativeEngine now holds its own AuthoritativeEngine (AE). Second, the DiscoveredEngines collection has been replaced with an AgentEngines collection, which is a Dictionary of known Agent AEs, using the agent's IPEndPoint as the key. This allows separate Users collections for each agent. (5324)
      • Updated decoding to handle non-spec messages which contain leading byte values of 0. (5345)
      • Made many fixes to the included Free Manager application. (5372)

       

       

      4.2.1.2 Released: 2010-06-04


       

      • SNMP for .NET now supports C++/CLI code generation, in addition to C# and VB.NET.
      • PowerSNMP has been updated with a new install and VS 2010 integration.

       

      Product fixes in this release:

      • Manager now responds to SNMPv3 Inform messages correctly. (5176)
      • Decoding is now forgiving of PDUs with 0-length encoded values. (5184)
      • Fixed re-naming issue for duplicate names in different modules. (5198)
      • Fixed v3 issue when a GetNext request initiates the discovery process. (5245)
      • Agent now sets Authoritative EngineBoots to correct value in response, after receiving a request with an incorrect value. (5297)

       

       

      4.2.0.0 Released: 2010-01-05


       

      • SNMP for .NET has a new licensing model. External runtime license files are no longer utilized. Instead, a license resource is generated and embedded within the executing assembly.

       

      Product fixes in this release:

      • Fixed an issue with v3 security where the agent no longer responds to certain discovery messages with NoSuchObject and UnknownEngineId variables. (5167)

       

       

      4.1.1.6 Released: 2009-10-30


       

      • An update to licensing and the help file. Note that users with an existing 4.1 Developer License File must obtain a new Developer License File for this release.
      • Product fixes in this release:
      • Fixed issues with agent and some v3 management software. (5127, 5136)
      • Fixed MIB parsing issue when END keyword was part of a description. (5138)
      • It is now possible to remove and re-add standard traps to MibNodes.Traps. (5144)

       

       

      4.1.0.1 Released: 2009-06-25


       

      • A new code generation feature has been added to the product. The MibNodes collection will have a GenerateCode method that will produce a code file that can be added to your C# or VB.NET project. The code file will provide an Import method which will import MibNode and MibTrap objects generated from parsed mib files into an existing MibNodes collection (for example, Manager.Mib). Also, it will create enumerations that will provide Intellisense for the GetByNodeName and GetByTrapName functions during development. See the Mib Treeview sample for a demonstration of code generation, and the Manager and Agent samples for an implementation of the generated code.
      • The MibNodes dictionary has been extended with a new Traps property, allowing for Trap referencing in parsed mibs. Traps can be indexed by name or by trap attributes.

       

       

      4.0.2.0 Released: 2009-06-03


       

      • Added Send and Receive methods to the ManagerSlave object to facilitate communication when the socket should not be blocked while waiting for a response.
      • Product fixes in this release:
      • Fixed a communication problem with some agents and managers when v3 security was used.

       

       

      4.0.1.0 Released: 2009-05-15


       

      • Various fixes to the MIB parser.

       

       

      4.0.0.2 Released: 2009-04-30


       

      • This latest version of the venerable PowerSNMP product line gets a new .NET 2.0 re-design that leverages the power of the latest .NET environments to provide the most advanced Internet Communications components available. Some of the features include:
      • SNMP version 1, 2 and 3 with authentication and encryption/decryption
      • Built-in objects, identifiers, traps, tables, notifications, and groups as defined in RFCs 1155, 1157, 1158, 1213, 2578, 2579, 3417 and 3418
      • MIB parsing, where any custom MIB file can be used to load MIB definitions
      • Start method for easily implemented multi-threaded applications, including cross-threading marshaling support
      • EncodedMessage property for easy debugging of bytes sent and received, as well as session logging
      • FIPS 140-2 compliant cryptography supports government and military requirements

       

       

      1.2.2.0 Released: 2009-03-03


       

      Product fixes in this release:

      • Objects with textual convention syntaxes now support enumerated values, if the textual convention defined them. (4096)
      • Fixed a MIB Class generation duplicate-name issue. (4776)
      • Variables contained within received messages now have populated Definitions, if the definition was compiled into the component.Mib. (4798)
      • The MIB parser is now more forgiving of "::=" tokens which are not surrounded by whitespace. (4981)

       

       

      1.2.1.0 Released: 2008-06-11


       

      • Version 1.2.0.0 was built without incorporating the fixes to issues 4715 and 4749.

       

       

      1.2.0.0 Released: 2008-06-06


       

      • The PowerSNMP Free Manager application source code is now included with PowerSNMP for .NET.
      • Product fixes in this release:
      • The GetTable method overloads will now recognize when there are missing cells and add null variables to preserve the table structure. (4577)
      • The Manager will now timeout correctly when requests are made to non-existent agents. (4715)
      • MibNodes.TrapMessages now include enterprise specific traps. (4739)
      • The GetTable method overloads no longer timeout immediately under high work loads. (4742)
      • Fixed v3 so all Auth/Priv/hashing combinations work. (4743)
      • Async v3 requests that should timeout now do so. (4749)

       

       

      1.1.0.4 Released: 2008-04-18


       

      • New MibNodes.Modules table provides information on compiled modules, including defined names and imported definitions.
      • New SimpleType.Opaque.ToHexString function converts variable values to hex string representations. Useful for physAddresses, netAddresses, etc.
      • Mib compilation now supports objects from different modules with identical names.

       

      Product fixes in this release:

      • The SortedVariables collection is now synchronized. (4648, 4691)
      • Addressed issues with SNMP v3 discovery. (4706)

       

       

      1.0.4.3 Released: 2007-11-20


       

      • Added a static GetReponse method to optimize performance in demanding multithreaded applications
      • Updated samples with enhanced v3 support
      • Exposed 'Clear' and 'Remove' methods of the 'SortedVariables' collection to allow removal of previously added items
      • Add 'TrapMessages' collection to 'MibNodes' object to allow examination of compiled trap definitions at runtime

       

      Product fixes in this release:

      • Manager can now communicate with Agents using MD5 authentication without privacy (4129)
      • Addressed internal exceptions causing problems in applications written using in Framework 2.0 or higher (4293)
      • Dynamic classes are no longer created internally. This was causing problems when used in Framework 2.0 or higher (4305)
      • Events are now properly raised, and responses are now sent, after receiving v2 and v3 requests for variables not added to Agent.Variables (4362)
      • Corrected problem with mib parsing of SYNTAX that would cause Variable.ValueName to be empty (4450)
      • Corrected condition that caused a premature timeout exception to occur during secure requests (4500)
      • Corrected decoding problem of v3 SHA authentication with privacy (4563)

       

       

      1.0.3.0 Released: 2006-10-26


       

      Product fixes in this release:

        • ErrorStatus.ReadOnly now supersedes ErrorStatus.NotWriteable (4004)
        • The Agent SetMessageReceivedEvent now fires when table cells are set (4099)
        • Addressed several problems related to GetBulk response messages (4124, 4125)
        • SortedVariables collections are now correctly sorted (4138)

       

       

      1.0.2.0 Released: 2006-08-11


       

        • 64-bit environments now supported
        • A new "MibNode.ComposedSyntax" property has been added
        • Product fixes in this release:
        • Memory leak when Manager was Closed has been addressed (4056)

       

       

      1.0.1.0 Released: 2006-06-21


       

      Product fixes in this release:

          • Corrected a problem where v2 trap messages were not decoded properly (3894)
          • Decoding problems now correctly raise a Decoding Exception (3895)

       

      Programming Primer

      This primer describes many useful things you need to know about implementing SNMP managers and agents. Written for PowerSNMP for .NET 4.7. Note the definitions available below.



      PowerSNMP is organized into 3 sub-systems
      1. Agent and Manager .NET components derive from SnmpBase for shared functionality. Integrates socket communications with thread management.
      2. SNMP message classes (GetMessage, GetBulkMessage, GetNextMessage, SetMessage, InformMessage, ReportMessage, Trap1Message, Trap2Message) derive from MessageBase. The Security class implements timeliness, authentication and encryption/decryption user-based security. By exposing properties and lists that correspond to PDU fields, the object model is familiar to knowlegable SNMP programmers and teaches SNMP terminology to the novice.
      3. MIB classes
        - Manager and Agent components can import MIB files at design-time. Source code is added to your project.
        - The MibNodes class can import MIB files at run-time to create dynamic MibNode definitions.
        - MibNode.Oid property associates a MIB definition with the IIDs found in PDUs.

       

       

      SNMP Version 3 Supports User-Based Security
      • Authentication and privacy password keys are used to hash and encrypt/decrypt PDUs. They are used by agent and manager and are not sent over the wire.
      • Security class contains the configuration items needed for encoding.
      • AuthoritativeEngine.Users dictionary uses a username key to lookup passwords needed for decoding.
      • RequestMessage provides automatic discovery of the remote authoritative engine configuration.

       

       

      Manager and Agent are the Core Components 
      1. Manager
        - Send a request and receive the response. In code, create a new GetMessage, GetBulkMessage, GetNextMessage, SetMessage or InformMessage and initialize properties. GetResponse() encodes and sends the request, receives the response, decodes it and returns a ResponseMessage. GetResponseTaskAsync() does the same using more scalable, awaitable, asynchronous I/O.
        - Receive inform requests (from agents and managers) and traps (from agents).

      2. Agent
        - Receive requests from managers. A default ResponseMessage can be easily created. Send() encodes and sends the ResponseMessage.
        - Send traps to managers. In code, create a new Trap1Message or Trap2Message and initialize properties. Send() encodes and sends the trap.
        - Send an inform request to a manager and receive the response. In code, create a new InformMessage and initialize properties. GetResponse() encodes and sends the request, receives the response from the manager, decodes it and returns a ResponseMessage. GetResponseTaskAsync() does the same using more scalable, awaitable, asynchronous I/O.

       

       

      Thread Management

      Worker threads and/or asynchronous communications is necessary to develop robust applications.

       

      1. Manager
        - Send a request and receive the response. Start(ThreadStart) starts a worker thread where GetResponse() encodes and sends the request, receives the response, decodes it and returns a ResponseMessage. The Manager can send multiple requests in parallel (one thread per request), in serial (one thread for all requests performed sequentially), or any combination thereof. Alternatively, GetResponseTaskAsync() does the same using more scalable, awaitable, asynchronous I/O.
        - Receive inform requests (from agents and managers) and traps (from agents). Start(ManagerMessageReceived) starts receiving packets asynchronously. For inform requests, Send() is used to encode and send a ResponseMessage.

      2. Agent
        - Receive requests from managers. Start(AgentMessageReceived) starts receiving packets asynchronously. Send() is used to encode and send a ResponseMessage.
        - Send traps to managers. Send() can be used on any thread (inluding the UI thread) because encoding and sending a trap is immediate and no response need be received.
        - Send an inform request to a manager and receive the response. Start(ThreadStart) starts a worker thread where GetResponse() encodes and sends the request, receives the response, decodes it and returns a ResponseMessage.

       

       

      Developing a Manager
      • Basic Manager (SNMPv1 or SNMPv2 without security)
        - Write a method that will send/receive your request(s). Try using code from the Manager sample application. Multiple requests can be accomplished in parallel or serially.
        - Start(ThreadStart) to execute your method on a worker thread. Alternatively, use the awaitable GetResponseTaskAsync() method to make the request without dedicating a thread.
      • Advanced Manager adds MIB, trap, inform support
        - MIB files can be loaded at design-time or run-time. They are used to build MibNode instances (that provide properties like Name, Description, Oid, Access, Usage, ValueType, etc.) to enhance business logic.
        - Write a method that will handle incoming trap and inform messages. Try using code from the Manager sample application.
        - Use Start(ManagerMessageReceived) to listen for traps and inform messages. Use Close() to stop listening.
      • Secure Manager uses SNMPv3 security
        - Set Security properties (username, passwords, etc.) and send requests per step 1 above. The Manager.Security.EngineCache cache optimizes performance.
        - To authenticate and decrypt SNMPv3 traps, add username/passwords to Manager.Security.TrapUsers.
        - To authenticate and decrypt SNMPv3 inform requests, add username/passwords to Manager.AuthoritativeEngine.Users.
        - Received PDUs are decoded using the username in the PDU to lookup the associated passwords in the AuthoritativeEngine.Users dictionary.

       

       

      Developing an Agent
      • Basic Agent (SNMPv1 or SNMPv2 without security)
        - Write a method to handle manager requests. Try using code from the Agent sample application.
        - Populate Agent.Variables with MIB values. Use CreateDefaultResponse() to build the ResponseMessage. Use Send(ResponseMessage) to encode and send the response.
        - Use Start(AgentMessageReceived...) to listen for requests. Use Close() to stop listening.
      • Advanced Agent adds MIB and trap support
        - MIB files can be loaded at design-time or run-time. They are used to build MibNode instances (that provide properties like Name, Description, Oid, Access, Usage, ValueType, etc.) to enhance business logic.
        - Send traps using Send(Trap1Message) or Send(Trap2Message).
      • Secure Agent uses SNMPv3 security
        - Set Agent.AuthoritativeEngine.Id to desired EngineId if default is not suitable.
        - Add username/passwords to AuthoritativeEngine.Users dictionary.
        - Configure authorized SNMP managers with username/passwords.
        - Received PDUs will be decoded using the username in the PDU.
      • Special use can involve sending an inform request to a manager.
        - Write a method that will send the inform request. Try using code from the Agent sample.
        - Use Start(ThreadStart) to execute your method on a worker thread.

       

       

      Definitions

      Names marked with an asterisk are also PowerSNMP class names. Lowercase is used to indicate generic use (not a class name).

       

      • Agent*. Provides MIB access for all SNMP managers.
      • Agent Discovery. Refers to the dynamic discovery of SNMP agents on the network. A manager can broadcast a GetMessage to all computers on the network, but this is becoming less useful as agents that support SNMPv3 decline to respond to broadcast messages. Polling a series of addresses is another alternative, but most manager applications will probably want to persist a list of agents between session.
      • AuthoritativeEngine*. Stores EngineID, EngineTime, EngineBoots and username/passwords used for decoding. The authoritative engine is the "owner" of the SNMPv3 security protocol configuration.
      • Discovery. Technique used to discover the EngineId, EngineTime and EngineBoots of a remote Authoritative Engine. Transparent to the programmer, negotiating packets can be accessed using the Agent.Log and Manager.Log events.
      • GetBulkMessage*. Queries an agent for bulk IID values. ResponseMessage represents the response returned by the Agent.
      • GetMessage*. Queries an agent for specified IID values. ResponseMessage represents the response returned by the Agent.
      • GetNextMessage*. Queries an agent for IID values that immediately follow the IDs provided. ResponseMessage represents the response returned by the Agent.
      • ID. General identifier. OIDs and IIDs are IDs.
      • IID. Instance identifier that references the value of an OID instance. "1.3.6.1.6.3.15.1.1.3.0" is an IID. For static OIDs a ".0" is appended to create the IID. For table OIDs a row indexer is appended to create the IID (the row indexer is a unique value for each row in the table).
      • InformMessage*. Informs a manager of IID values. ResponseMessage represents the response returned by the Manager.
      • Manager*. Manages MIB data via agents. Can receive inform and trap notifications.
      • MIB. Management Information Base (data that is read and managed by managers via an agent).
      • MIB file. A structured document that defines OIDs. Often parsed by managers to provide contextual information to the user.
      • MIB tree. The MIB is often described as a tree graph consisting of OID nodes. An OID with no sub-node is a leaf and has one or more IIDs that reference its data. A static leaf is referenced by appending ".0" to the OID (there is only one value for this kind of leaf). The other kind of leaf is a table row instance, where a table column is designated as the indexer and that value is appended instead of "0".
      • OID. Object identifier. An OID as a class definition. "1.3.6.1.6.3.15.1.1.3" is an OID. Each digit, separated by periods, defines a node in the MIB tree.
      • Protocol Data Unit (PDU). The encoded bytes that represent an SNMP request, response, inform, report or trap.
      • RemoteEngines*. A dictionary of AuthoritativeEngine objects, using an IPEndPoint key, that caches security data and stores username/passwords needed for decoding.
      • ReportMessage*. Reports information to a manager (a special kind of ResponseMessage). Used during SNMPv3 discovery.
      • RequestMessage*. Base class for GetMessage, SetMessage, GetBulkMessage, GetNextMessage and InformMessage. These messages require a response.
      • ResponseMessage*. Class used to return variable values requested.
      • SetMessage*. Asks an agent to set IID values. ResponseMessage represents the response returned by the Agent that confirms the values were set.
      • Threading. A new worker thread is typically used when a request/response pair are sent/received. Socket.ReceiveFrom() efficiently sleeps until a ResponseMessage is received. This technique protects other application threads from processing delays associated with timeouts, and is recommended.
      • Trap1Message*. Notifies a manager of SNMPv1 errors (can include variables). No response required.
      • Trap2Message*. Notifies a manager of SNMPv2/3 errors (can include variables). No response required.
      • User Based Security. SNMPv3 supports this security model. EngineID and elapsed time are used to ensure timeliness (so packets cannot be replayed later). Optional authenticatin can be specified (a one-way hash ensures the packet has not been tampered with). Optional encryption can be specified (a shared key cypher encrypts the PDU).
      • Variable*. An IID/value pair. PDUs contain variables.

       


      Summary

      This primer relies on terminology and software constructs that some might consider advanced. Please start by compiling and running our Manager and Agent applications. Look these over and see how multi-threading is used to implement complex operations using very little code.

      The following example demonstrates an SNMP variable query in a Windows Forms environment. The query is executed asynchronously, without blocking the UI. The UI is updated with the agent's response.

       

      < Return to Overview

       

      private void button1_Click(object sender, EventArgs e)
      {
          //This application has a User-Interface, which we do not want to block.
          //Start launches the specified method on a worker thread.
          //Event handlers execute on the UI thread.
          manager1.Start(sendGetRequest, manager1.Mib.CreateVariable(NodeName.sysContact));
      }
       

      private void sendGetRequest(Dart.Snmp.ManagerSlave slave, object state)
      {
          //This function performs an SNMP Get operation using blocking calls.
          //Use the Start method to execute this function on a worker thread.
          try
          {
              GetMessage request = new GetMessage();
              request.Community = "public";
              request.Version = SnmpVersion.One;
              request.Variables.Add(state as Variable);

              //Send request and get response
              ResponseMessage response = slave.GetResponse(request, myAgentAddress);

              //Marshal message to the UI thread using the Message event.
              manager1.Marshal(new ResponseMessage[] { response }, ""null);
          }
          catch (Exception ex)
          {
              //Marshal exceptions to the UI thread via the Error event.
              manager1.Marshal(ex);
          }
      }
       

      private void manager1_Message(object sender, Dart.Snmp.MessageEventArgs e)
      {
          //Display info about the first variable in the response, and its value.
          //This event fires on the UI thread when a Message is marshaled.
          Variable var = e.Messages[0].Variables[0] as Variable;
          label1.Text = var.Definition.ToString() + var.Value.ToString();
      }
       

      private void manager1_Error(object sender, ErrorEventArgs e)
      {
          //Update the log with any exceptions that occur.
          //This event fires on the UI thread when an Exception is marshaled.
          textLog.AppendText("ERROR: " + e.GetException().Message + "\r\n");
      }

      The following example demonstrates an SNMP agent in a Windows Forms environment. The agent receives requests and responds.

       

      < Return to Overview

       

      private void button1_Click(object sender, EventArgs e)
      {
          //This application has a User-Interface, which we do not want to block.
          //A callback function is passed to Start, which launches an internal worker thread
          //that listens for requests.
          //This simple example supports just one variable, which is added to the agent's
          //variables collection.
          string iid = agent1.Mib.GetByNodeName(NodeName.sysContact).Iid;
          agent1.Variables.Add(iid, agent1.Mib.CreateVariable(NodeName.sysContact, "Ned Stark"));
       
          //Start listening for requests.
          agent1.Start(agent1_MessageReceived, null);
      }
       

      private void agent1_MessageReceived(Agent agent, RequestMessage request, object state)
      {
          //This callback function executes whenever the agent receives a request.
          //A Response message is created and sent to the querying manager.
          agent1.Send(agent1.CreateDefaultResponse(request), request.Origin);
      }

      Use the Snmp Manager component to easily add SNMP management capabilities to your application. Provides an easy-to-use interface that handles the details of querying SNMP Agents that exist on the network. Features include:

      • Send SNMP requests and receive responses and traps from SNMP agents. All encoding/decoding is automatic.
      • Supports SNMP versions 1, 2 and 3.
      • No knowledge of SNMP message formats required.
      • Reads MIB files at run time and generates dynamic nodes representing object identifiers.
      • Blocking methods return a response or table to the executing thread, and can be used in ASP.NET.
      • Start method provides easy to implement worker thread operation.
      • Marshal methods marshal data to the UI thread.
      • Captures and decodes Traps and Notifications.
      • Build messages by setting properties, adding simple variable (OID) objects, and sending. It doesn't get any easier!
      • Retrieve tables with a single method call.
      • Inform messages are fully supported.
      • Supports IPv6
      • Discover agents on the network, and broadcast requests
      • Log all messages sent and received
      • Supports C#, VB.NET, C++/CLI, ASP.NET and other .NET compliant development environments

       

      See a Manager component code example >

      Use the Snmp Agent component to easily build SNMP agents. Provides an easy-to-use interface that handles the details of processing and responding to an SNMP Manager's request. Features include:

       

      • Agent component generates responses to requests and can also initiate trap and notification (v2 trap) messages.
      • Supports SNMP versions 1, 2 and 3.
      • Requires no other system support besides basic Winsock transport.
      • No knowledge of SNMP message formats required.
      • Reads MIB files at run time and generates dynamic nodes representing object identifiers
      • Handle responses for all requests with an easy CreateDefaultResponse method.
      • Automatically switches between v1, v2 and v3 messages.
      • Start method provides easy to implement operation on a worker thread.
      • Marshal methods handle data marshaling to the UI thread.
      • Build messages by setting properties, adding simple variable (OID) objects, and sending. It doesn't get any easier!
      • IPv6 support
      • Respond to or ignore broadcasted requests

       

      See an Agent component code example >

      Agent

      Problem:

      The developer is faced with the challenge of creating a fully functional SNMP Agent with optional v3 support. The application must:

      • Respond to all types of SNMP queries (Get, Set, etc)
      • Support secure v3 queries
      • Send v1 Trap and v2/v3 Notify messages
      • Implement a dynamic SNMP table
      • Maintain a v3 User table

       

       

      Solution:

      With the PowerSNMP Agent component, applications can accomplish all these tasks. The sample demonstrates:

      • Automatic responses to SNMP queries of standard System Group objects
      • v3 security with an interface for maintaining users and passwords
      • Dynamic updates of the objects supported by the agent
      • An SNMP "Set Request" table with rows that are added dynamically when the agent receives a Set request
      • An interface for sending Trap and Notify messages
      • The Agent sample is included with the full trial installation of PowerSNMP for .NET.


      < Return to Code Examples

      Manager

      Problem:

      The developer is faced with the challenge of creating a fully functional SNMP Manager with optional v3 support. The application must:

      • Discover agents on a network
      • Get and set agents variables
      • Support v1, v2 and secure v3 queries
      • Send and receive Inform messages
      • Receive Trap and Notify messages
      • Retrieve SNMP tables
      • Maintain a v3 User table
      • Log SNMP activity

       

       

       

      Solution:

      With the PowerSNMP Manager component, applications can accomplish all these tasks. The sample demonstrates:

      • Agent discovery using the broadcast address
      • Getting agent variable values
      • Setting writable agent variable values
      • v3 Security with an interface for maintaining users and passwords
      • Sending Inform messages to other managers
      • Receiving and logging Trap, Notify and Inform messages
      • Retrieving and displaying SNMP tables
      • The Manager sample is included with the full trial installation of PowerSNMP for .NET. To download this sample with additional product-specific samples and documentation, see the following:

       

      < Return to Code Examples

      Trap Catcher

      Problem:

      The developer wishes to catch and handle SNMP trap and notify messages. The application must:

      • Receive and process v1 Trap and v2 Notify messages
      • Accept secure v3 Notifications
      • Maintain a v3 User table for known agents
      • Log SNMP activity to the User Interface or disk
      • Present important trap information to the user

       

       

       

      Solution:

      With the PowerSNMP Manager component, applications can accomplish all these tasks.

       

      The Trap Catcher sample is included with the full trial installation of PowerSNMP for .NET. To download this sample with additional product-specific samples and documentation, see the following:

       

      < Return to Code Examples

      MIB Treeview

      Problem:

      The developer wishes to dynamically parse MIB files and display the MIB tree hierarchy. The application must:

      • Parse standard and custom MIB files
      • Present the MIB hierarchy as an elegant tree
      • Add new MIB files to the existing hierarchy
      • Report and log any parsing errors
      • Display definition information for objects in the tree

       

       

      Solution:

      With the PowerSNMP MibNodes collection, applications can accomplish all these tasks.

      The MIB Treeview sample is included with the full trial installation of PowerSNMP for .NET. To download this sample with additional product-specific samples and documentation, see the following:

       

      < Return to Code Examples

       

      MIB Walker

      Problem:

      The developer wishes to get all of an agent's variables under a specified OID, and display the variables in a list or tree. The application must:

      • Prompt the user for a root OID and retrieve all an agent's variables in its subtree
      • Present retrieved variables in a list or as a tree
      • Dynamically load MIB files to provide definitions for retrieved variables
      • Report and log any errors
      • Display name and definition information for variables in the tree

       

      

       

      Solution:

      With the PowerSNMP MibNodes collection, applications can accomplish all these tasks.

      The MIB Walker sample is included with the full trial installation of PowerSNMP for .NET. To download this sample with additional product-specific samples and documentation, see the following:

       

      < Return to Code Examples

      SNMP Poll

      Problem:

      The developer wishes to poll many variables from multiple agents. The application must:

      • Simultaneously and independently poll numerous SNMP variables
      • Poll multiple agents at a high performance
      • Work unattended and poll at varying intervals
      • Discover available agents on the network
      • Present variables from dynamically loaded MIB files
      • Track poll results in a table

       

       

       

      Solution:

      With the PowerSNMP Manager component, applications can accomplish all these tasks.

      The SNMP Polling Sample sample is included with the full trial installation of PowerSNMP for .NET. To download this sample with additional product-specific samples and documentation, see the following:

       

      < Return to Code Examples

      Web Manager (ASP.NET)

      Problem:

      The developer wishes to get an agent's system variables using a web application. The application must:

      • Be a server-side ASP.NET application
      • Retrieve all variables in an agent's system group
      • Support SNMP versions 1, 2 and 3
      • Report any errors during the process

       

       

      Solution:

      With the PowerSNMP Manager component, applications can accomplish all these tasks.

      The SNMP Web Manager sample for ASP.NET is included with the full trial installation of PowerSNMP for .NET. To download this sample with additional product-specific samples and documentation, see the following:

       

      < Return to Code Examples

      Windows Forms SNMP Agent Code Example

      The following example demonstrates an SNMP agent in a Windows Forms environment. The agent receives requests and responds.

       

      < Return to Overview

       

      private void button1_Click(object sender, EventArgs e)
      {
          //This application has a User-Interface, which we do not want to block.
          //A callback function is passed to Start, which launches an internal worker thread
          //that listens for requests.
          //This simple example supports just one variable, which is added to the agent's
          //variables collection.
          string iid = agent1.Mib.GetByNodeName(NodeName.sysContact).Iid;
          agent1.Variables.Add(iid, agent1.Mib.CreateVariable(NodeName.sysContact, "Ned Stark"));
       
          //Start listening for requests.
          agent1.Start(agent1_MessageReceived, null);
      }
       

      private void agent1_MessageReceived(Agent agent, RequestMessage request, object state)
      {
          //This callback function executes whenever the agent receives a request.
          //A Response message is created and sent to the querying manager.
          agent1.Send(agent1.CreateDefaultResponse(request), request.Origin);
      }

      Windows Forms SNMP Manager Code Example

      The following example demonstrates an SNMP variable query in a Windows Forms environment. The query is executed asynchronously, without blocking the UI. The UI is updated with the agent's response.

       

      < Return to Overview

       

      private void button1_Click(object sender, EventArgs e)
      {
      //This application has a User-Interface, which we do not want to block.
      //Start launches the specified method on a worker thread.
      //Event handlers execute on the UI thread.
      manager1.Start(sendGetRequest, manager1.Mib.CreateVariable(NodeName.sysContact));
      }


      private void sendGetRequest(Dart.Snmp.ManagerSlave slave, object state)
      {
      //This function performs an SNMP Get operation using blocking calls.
      //Use the Start method to execute this function on a worker thread.
      try
      {
      GetMessage request = new GetMessage();
      request.Community = "public";
      request.Version = SnmpVersion.One;
      request.Variables.Add(state as Variable);

      //Send request and get response
      ResponseMessage response = slave.GetResponse(request, myAgentAddress);

      //Marshal message to the UI thread using the Message event.
      manager1.Marshal(new ResponseMessage[] { response }, "", null);
      }
      catch (Exception ex)
      {
      //Marshal exceptions to the UI thread via the Error event.
      manager1.Marshal(ex);
      }
      }


      private void manager1_Message(object sender, Dart.Snmp.MessageEventArgs e)
      {
      //Display info about the first variable in the response, and its value.
      //This event fires on the UI thread when a Message is marshaled.
      Variable var = e.Messages[0].Variables[0] as Variable;
      label1.Text = var.Definition.ToString() + var.Value.ToString();
      }


      private void manager1_Error(object sender, ErrorEventArgs e)
      {
      //Update the log with any exceptions that occur.
      //This event fires on the UI thread when an Exception is marshaled.
      textLog.AppendText("ERROR: " + e.GetException().Message + "\r\n");
      }

      Purchase Options

      Customize your product and support options match your needs. Discounts are applied when products are purchased in multiples or within available product suites.

      $0.00 discount
       
      $1,199.00

      Have any questions about purchasing? See our Sales FAQ