PowerSNMP for .NET | Get Request Code Example

See all PowerSNMP for .NET Code Examples

Get Request Example

This example demonstrates sending a Get request and receiving the response.


//Create Manager, and Socket to send request from
Manager manager1 = new Manager();
SnmpSocket managerSocket = new SnmpSocket(manager1);

//Create Get Request
GetMessage request = new GetMessage();
//Or by IID: request.Variables.Add(manager1.Mib.CreateVariable(new Variable(""));

//Optionally use version 3. Set username and passwords.
request.Version = SnmpVersion.Three;
request.Security.User.Name = "testAuthPriv";
request.Security.User.AuthenticationProtocol = AuthenticationProtocol.Md5;
request.Security.User.AuthenticationPassword = "dartauth";
request.Security.User.PrivacyProtocol = PrivacyProtocol.Des;
request.Security.User.PrivacyPassword = "dartpriv";

//Send request and get response
ResponseMessage response = managerSocket.GetResponse(request, new Dart.Snmp.IPEndPoint("myAgentAddress", Agent.DefaultPort));

//Display the value


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