最近兜兜转转,看了各种各样的OPC UA的库,尤其是看了OPC Foundation的库后,特别困惑,直到耐着性子看完milo库的Server例子后,对于如何写一个OPC UA服务器终于有了一定的了解。
Milo是Eclipse开源的项目之一,GitHub地址:Milo
我们直接通过Server的例程来了解整个Server是怎么运行的:
1.主体函数
public static void main(String[] args) throws Exception {
ExampleServer server = new ExampleServer();
server.startup().get();
final CompletableFuture<Void> future = new CompletableFuture<>();
Runtime.getRuntime().addShutdownHook(new Thread(() -> future.complete(null)));
future.get();
}
这是Se