Login  
Search All Forums
Dart Home | PowerSNMP for .NET | Custom Development Reply | PowerSNMP for .NET Topics | Forums   
AuthorForum: PowerSNMP for .NET
Topic: Using SNMP Data Type BITS
ARD-TECH

From: WARWICK, United Kingdom
Posts: 2
Member Since: 06/16/20
posted June 16, 2020 4:08 PM

Hi,
I’m trying to write/set using an SNMP DataType BITS but I’m unsure of how to use it. I’m using PowerSNMP.NET v4.8 and I can’t seem to find any instructions/examples how to use SNMP DataType BITS?

What do I need to do to the sMessage string to send it as a BIT String?

Text = {0,1}

Dim sMessage As String = "{0,1}" ' SnmpTypes_BITSTRING
SNMPSetMessageBITS(sMessage)

Private Sub SNMPSetMessageBITS(ByVal sMessage as String)
    Dim managerSocket As New Dart.Snmp.SnmpSocket(Manager1)
    Dim request As New Dart.Snmp.SetMessage
    Dim var1 As New Dart.Snmp.Variable("1.3.6.1.4.1.5555.1.2.2")

    var1.Value = New Dart.Snmp.SimpleType.OctetString(sMessage)

    request.Variables.Add(var1)
    request.Community = "Public"
    request.Version = SnmpVersion.One

    managerSocket.ReceiveTimeout = 2000
    Dim response As ResponseMessage = managerSocket.GetResponse(request, "192.168.0.10")
    If response.ErrorStatus <> ErrorStatus.Success Then
      Debug.Print("Error: " & response.ErrorStatus)
    End If
End Sub
Jamie Powell (Admin)

From: Rome, NY USA
Posts: 448
Member Since: 03/13/07

Extra Support Options
Custom Application Development

posted June 16, 2020 4:54 PM

Thank you for your post. If additional technical support is required, purchase of a support and maintenance Subscription will be needed. Please see below for a response from our technical team and feel free to contact sales@dart.com if you're interested in adding a Subscription to your account.

The only thing that stands out as possibly wrong with your code is that you specify the community as "Public", instead of the more common default of "public", but that could be your community. However, after reviewing these topics, it seems you should investigate more about the implementation of the BIT string type (which isn't a base type):
https://www.webnms.com/snmp/help/snmpapi/snmpv3/using_mibs_in_applns/bits_datatype.html
https://sourceforge.net/p/net-snmp/mailman/message/15755421/

Best regards,
Jamie
ARD-TECH

From: WARWICK, United Kingdom
Posts: 2
Member Since: 06/16/20
posted June 17, 2020 4:23 PM

Hi Jamie, Thanks for the reply.

Yes the community string should be public but that's not the real issue.

Does PowerSNMP have a method to convert a BITS String Array {0,1} to SNMP BITS format?

String Array {0,1} to Binary = 11000000
Binary 11000000 to hex = 0xc0

I'm using iReasoning to currently do this but couldn't see any functions/examples in PowerSNMP





Jamie Powell (Admin)

From: Rome, NY USA
Posts: 448
Member Since: 03/13/07

Extra Support Options
Custom Application Development

posted June 23, 2020 1:27 PM

"Does PowerSNMP have a method to convert a BITS String Array {0,1} to SNMP BITS format?" - no, as it is not a type defined in the SNMP RFCs.

From what I've read in the above mentioned articles, you can use the OctetString for implementing BITS, although I might also suggest looking into how to embed hex values in strings under .NET, if needed.

I hope this helps.

All the best,
Jamie

------
-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.
------

Reply | PowerSNMP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX