This commit is contained in:
USER-20220102CG\noblelift
2023-01-31 21:09:53 +08:00
2 changed files with 11 additions and 1 deletions

View File

@@ -11,7 +11,8 @@ public class OpcServerUtl {
if (domain == null) {
domain = "";
}
return OpcUtl.getServer(host, clsid, user, password, domain);
// return OpcUtl.getServer(host, clsid, user, password, domain);
return OpcUtl.getAutoServer(host, clsid, user, password, domain);
} else {
return null;
}

View File

@@ -159,6 +159,15 @@ public class OpcUtl {
}
}
public static Server getAutoServer(String host, String clsid, String user, String password, String domain) throws WDKException {
checkTimeout();
Server server = null;
server = new Server(getConnection(host, clsid, user, password, domain), Executors.newSingleThreadScheduledExecutor());
AutoReconnectController autoReconnectController = new AutoReconnectController(server);
autoReconnectController.connect();
return server;
}
public static ConnectionInformation getConnection(String host, String clsid, String user, String password,
String domain) {
ConnectionInformation connection = new ConnectionInformation();