DDE:C# NDde DdeClient.Request 频繁返回“无数据”?
使用 C# 中的 NDde 项目 (http://ndde.codeplex.com/) 从 DDE 服务器读取数据。通常,DdeClient 方法 Request() 将返回“#No Data”。再次调用同样的方法,就会返回数据。为什么会出现这种情况?
怎么解决呢?请注意,我尝试将 Request() 调用放入循环中,这样如果没有返回数据,它将重试给定的次数。然而,即使循环 10 次数据,有时仍会返回“无数据”。但是,如果我设置断点,第二次几乎总是会返回数据。我猜这是因为请求之间的时间较长。
Using NDde project (http://ndde.codeplex.com/) from C# to read data from DDE server. Frequently, the DdeClient method Request() will return "#No Data". Calling the exact same method again and the data will be returned. Why does this happen?
How to solve it? Note I tried putting the Request() call in a loop such that if no data is returned then it will retry for a given number of times. However, looping even 10 times the data will still sometimes come back "No Data". However, if I set a breakpoint, the data will almost always be returned the second time. I'm guessing this is because there is a longer time between requests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不使用建议功能而不是请求功能。为此,请订阅 Advise 活动?
其中 OnAdvise 是事件处理程序方法。然后启动建议循环。
现在,当数据可用时,Advise 事件将触发,您将从 EventArgs 获取数据。
Why not use the Advise functionality instead of Request. To do that subscribe to the Advise event?
where OnAdvise is the event handler method. Then start the advise loop.
Now when the data becomes available, the Advise event will fire and you will get your data from the EventArgs.
如果我不得不猜测,我会说 DDE 服务器可能存在计时问题。您是否尝试过
Request
操作之间的时间间隔?If I had to guess I would say there is probably a timing issue with the DDE server. Did you try temporal spacing between the
Request
operations?