Dart.Snmp Namespace : SetMessage Class |
<SerializableAttribute()> Public Class SetMessage Inherits RequestMessage
Dim instance As SetMessage
[Serializable()] public class SetMessage : RequestMessage
[Serializable()] public __gc class SetMessage : public RequestMessage
[Serializable()] public ref class SetMessage : public RequestMessage
SetMessage derives from StandardMessage.
Typically, only IIDs with Access.WriteOnly or Access.ReadWrite access may be updated using SetMessage.
Serializable using BinaryFormatter and XmlSerializer.
private void button1_Click(object sender, EventArgs e) { //Create and send request on a worker thread manager1.Start(sendRequest, manager1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin")); } private void sendRequest(SnmpSocket managerSocket, object state) { //Create Set Request SetMessage request = new SetMessage(); request.Variables.Add(state as Variable); //Use version 3. Setup security 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, myAgentAddress); //Marshal message to the UI thread using the Message event manager1.Marshal(new ResponseMessage[] { response }, "", null); } private void manager1_Message(object sender, Dart.Snmp.MessageEventArgs e) { //Fires on the UI thread //Display info about the first variable in the response, and its value Variable vari = e.Messages[0].Variables[0]; label1.Text = vari.Definition.ToString() + "\r\nValue: " + vari.Value.ToString(); }
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) 'Create and send request on a worker thread manager1.Start(AddressOf sendRequest, manager1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin")) End Sub Private Sub sendRequest(ByVal managerSocket As SnmpSocket, ByVal state As Object) 'Create Set Request Dim request As New SetMessage() request.Variables.Add(TryCast(state, Variable)) 'Use version 3. Setup security 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 Dim response As ResponseMessage = managerSocket.GetResponse(request, myAgentAddress) 'Marshal message to the UI thread using the Message event manager1.Marshal(New ResponseMessage() { response }, "", Nothing) End Sub Private Sub manager1_Message(ByVal sender As Object, ByVal e As Dart.Snmp.MessageEventArgs) 'Fires on the UI thread 'Display info about the first variable in the response, and its value Dim vari As Variable = e.Messages(0).Variables(0) label1.Text = vari.Definition.ToString() & vbCrLf & "Value: " & vari.Value.ToString() End Sub
System.Object
Dart.Snmp.MessageBase
Dart.Snmp.StandardMessage
Dart.Snmp.RequestMessage
Dart.Snmp.SetMessage