跳到主要内容

BrowseNext

子节点超过服务端单页限制时, 响应里会带一个非空的 ContinuationPoint (续翻凭证). 只有 BrowseWithPaging 把它交给你, 用 BrowseNext 继续拿下一页.

前置阅读

签名​

public BrowsePage BrowseNext(byte[] continuationPoint, bool release = false);
参数说明
continuationPoint上一次 Browse / BrowseNext 返回的续翻凭证
releasetrue = 放弃续翻, 服务端释放资源 (不返回 references)

BrowsePage 字段​

public sealed class BrowsePage
{
public IReadOnlyList<OpcUaReference> References { get; init; }
public byte[] ContinuationPoint { get; init; } // null 表示无更多页
}

完整翻页例子​

var page = ua.BrowseWithPaging("ns=2;s=BigFolder");
var allRefs = new List<OpcUaReference>(page.References);

while (page.ContinuationPoint != null)
{
page = ua.BrowseNext(page.ContinuationPoint);
allRefs.AddRange(page.References);
}

Console.WriteLine($"Total {allRefs.Count} children");

主动释放 (节省服务端资源)​

服务端为每个 ContinuationPoint 维护状态, 占用资源. 如果中途不想继续翻, 调 release=true 显式释放:

ua.BrowseNext(page.ContinuationPoint, release: true);

不显式释放的话, 服务端要等它自己按会话策略回收 (回收时机由服务端定, SDK 不做保证).

注意​

  • ContinuationPoint 是不透明字节数组, 不要修改 / 解析 / 拼接
  • 翻页用最新一次返回的 ContinuationPoint 继续 — 每次 BrowseNext 都会给你一个新的, 旧的别再拿去翻
  • 续点是服务端按会话维护的资源, 拿到就尽快翻完, 不要攒着长期不翻

下一步​