public async Task <(int bulkwalkResult, IList <Variable> results)> GetSubtreeV2Async(IPAddress ip, string oid, string community, int port, int?maxRepetitions, int?retries, TimeSpan?timeout) { if (ip == null) { throw new ArgumentNullException(nameof(ip)); } if (string.IsNullOrWhiteSpace(oid)) { throw new ArgumentNullException(nameof(oid)); } if (!Regex.IsMatch(oid, @"^(([0-9]+)\.)+[0-9]+$")) { throw new ArgumentException(oid, nameof(oid)); } if (string.IsNullOrWhiteSpace(community)) { throw new ArgumentNullException(nameof(community)); } if (port <= 0) { throw new ArgumentOutOfRangeException(nameof(port), port.ToString()); } var maxRepetitionsValue = maxRepetitions ?? 10; if (maxRepetitionsValue <= 0) { throw new ArgumentOutOfRangeException(nameof(maxRepetitions), maxRepetitions.ToString()); } var retriesValue = retries ?? 2; if (retriesValue <= 0) { throw new ArgumentOutOfRangeException(nameof(retries), retries.ToString()); } var timeoutMs = timeout ?? TimeSpan.FromSeconds(5); if (timeoutMs <= TimeSpan.Zero) { throw new ArgumentOutOfRangeException(nameof(timeout), timeout.ToString()); } var results = new List <Variable>(); var bulkwalkResult = await MyMessenger.BulkWalkV2Async( new IPEndPoint(ip, port), community == null?OctetString.Empty : new OctetString(community), new ObjectIdentifier(oid), results, maxRepetitionsValue, retriesValue, timeoutMs, WalkMode.WithinSubtree ).ConfigureAwait(false); return(bulkwalkResult, results); }