Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all articles
Browse latest Browse all 576

New Post: varbind list construction

$
0
0
If we start from the sample code on that page, you can see how to construct the simplest variable binding via
    # Create OID variable list
    $vList = New-GenericObject System.Collections.Generic.List Lextm.SharpSnmpLib.Variable                        # PowerShell v1 and v2
    # $vList = New-Object 'System.Collections.Generic.List[Lextm.SharpSnmpLib.Variable]'                          # PowerShell v3
    foreach ($sOID in $sOIDs) {
        $oid = New-Object Lextm.SharpSnmpLib.ObjectIdentifier ($sOID)
        $vList.Add($oid)
    }
To fulfill your needs of setting OCTET STRING value for each of the variables, the only change you need to make is to use another constructor of Lextm.SharpSnmpLib.ObjectIdentifier,

http://help.sharpsnmp.com/html/M_Lextm_SharpSnmpLib_Variable__ctor_1.htm

To pass the data you want, use one of OctetString's constructors to construct a new object,

http://help.sharpsnmp.com/html/Overload_Lextm_SharpSnmpLib_OctetString__ctor.htm

Viewing all articles
Browse latest Browse all 576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>