PowerSNMP for .NET | Set Request Code Example

See all PowerSNMP for .NET Code Examples

Set Request Example

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


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

//Create Set Request
SetMessage request = new SetMessage();
request.Variables.Add(manager1.Mib.CreateVariable(NodeName.sysContact), "Systems Admin");

//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));

//Confirmation that the value was updated by the agent:


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