Dart.Snmp Namespace > SnmpSocket Class > SnmpSocket Constructor : SnmpSocket Constructor(SnmpBase) |
Dim entity As SnmpBase Dim instance As New SnmpSocket(entity)
private void button1_Click(object sender, EventArgs e) { //Bind to a socket to send the GetMessage on SnmpSocket managerSocket = new SnmpSocket(manager1); //Create Get request GetMessage request = new GetMessage(); request.Variables.Add(manager1.Mib.CreateVariable(NodeName.sysContact)); //Send request and get response ResponseMessage response = managerSocket.GetResponse(request, myAgentAddress); //Display info about the first variable in the response, and its value Variable vari = response.Variables[0]; label1.Text = vari.Definition.ToString() + vari.Value.ToString(); //Close the socket when done managerSocket.Close(); }
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) 'Bind to a socket to send the GetMessage on Dim managerSocket As New SnmpSocket(manager1) 'Create Get request Dim request As New GetMessage() request.Variables.Add(manager1.Mib.CreateVariable(NodeName.sysContact)) 'Send request and get response Dim response As ResponseMessage = managerSocket.GetResponse(request, myAgentAddress) 'Display info about the first variable in the response, and its value Dim vari As Variable = response.Variables(0) label1.Text = vari.Definition.ToString() & vari.Value.ToString() 'Close the socket when done managerSocket.Close() End Sub