- 在使用utgard访问OPC服务器,使用异步(Async20Access)读取数据时,总是出错,同步读取就可以,我想问一下,这是什么问题? 下面是console输出:Recieved FAULT 最后接到一个FAULT,不知道什么原因,请赐教!
-
代码:
public static void main ( final String[] args ) throws Throwable
{
// create connection information
final ConnectionInformation ci = new ConnectionInformation ();
ci.setHost("127.0.0.1"); // 电脑IP
ci.setDomain(""); // 域,为空就行
ci.setUser("opcuser"); // 电脑上自己建好的用户名
ci.setPassword("123456"); //密码// 使用KEPServer的配置 ci.setClsid("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"); final Set<String> items = new HashSet<String> (); if ( items.isEmpty () ) { items.add ("ch1.d1.tag1"); items.add ("ch1.d1.tag2"); } // create a new server final Server server = new Server ( ci, Executors.newSingleThreadScheduledExecutor () ); try { // connect to server server.connect (); // add sync access final AccessBase access = new Async20Access ( server, 100, false ); for ( final String itemId : items ) { access.addItem ( itemId, new DataCallbackDumper () ); } // start reading access.bind (); // wait a little bit _log.info ( "Sleep for some seconds to give events a chance..." ); Thread.sleep ( 10 * 1000 ); _log.info ( "Returned from sleep" ); // stop reading access.unbind (); } catch ( final JIException e ) { System.out.println ( String.format ( "%08X: %s", e.getErrorCode (), server.getErrorMessage ( e.getErrorCode () ) ) ); }
}
} 我发现同样的代码,采用同步读取就没有问题,这是为什么?是不是对异步需要对环境进一步配置?
我的邮箱:sangjingrui@163.com
utgard在使用异步(Async20Access)读取数据时,总是出错,我的邮箱:sangjingrui@163.com
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
悬赏问题
- ¥15 安卓adb backup备份应用数据失败
- ¥15 eclipse运行项目时遇到的问题
- ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
- ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
- ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
- ¥50 成都蓉城足球俱乐部小程序抢票
- ¥15 yolov7训练自己的数据集
- ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
- ¥15 电力市场出清matlab yalmip kkt 双层优化问题
- ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)