Windows XPe RAS 错误 756“正在拨打连接”

发布于 2024-11-15 05:45:02 字数 407 浏览 6 评论 0原文

我正在使用一个已经设置了 RAS 条目的嵌入式系统,使用 rasapi32.dll 中的 API 函数 RasDial。

除非 RasDial 之后和 RasHangUp 之前出现问题,否则一切正常。在这种情况下,任何进一步的拨号尝试都会遇到错误 756“连接正在拨号”,无论拨号尝试是通过 API 还是通过 Windows rasdial 命令行实用程序完成。

rasdial connectionname /d 也没有帮助。

用于调制解调器的 COM 端口被锁定。

恢复的唯一方法是重新启动。

显然,正常情况下的解决方案是确保 RasDial 始终跟随 RasHangUp。但对于这种情况没有发生的情况,是否有办法中止拨号尝试?例如,如果应用程序调用 RasDial 然后崩溃,除了重新启动之外,如何摆脱这种情况?

I'm working with an embedded system which has a RAS entry already set up, using the API function RasDial from rasapi32.dll.

All works well except if something goes wrong after RasDial and before RasHangUp. In this case any further attempt to dial is met with error 756 "connection is being dialled", whether the dial attempt is done via the API or via the Windows rasdial command line utility.

rasdial connectionname /d doesn't help either.

The com port used for the modem is locked.

The only way to recover is to reboot.

Obviously under normal circumstances the solution is to make sure that RasDial is always followed by RasHangUp. But for cases where this doesn't happen, is there a way of aborting the dial attempt? For example, if the app calls RasDial and then crashes, how do I get out of that other than by rebooting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍景流年 2024-11-22 05:45:02

不幸的是,除非您的应用程序能够在退出之前正确终止正在进行的连接,否则 RAS 状态机将被损坏,并且必须重新启动才能解决问题。我注意到 Windows 7 比 XP 和 Vista 更好地处理此类情况,但有时我仍然不得不重新启动。

只要 DotRas API 发生在 RasDialer 的事件处理程序中,我就成功地防止了大多数此类问题,但如果应用程序从另一个线程崩溃,而不是从引发 RasDialer 事件的后台线程崩溃,对此我无能为力。

对于使用 DotRas 1.2 SDK 的异步拨号:

using DotRas;

RasDialer dialer = new RasDialer();
dialer.EntryName = "My Connection";
dialer.Credentials = new NetworkCredential("My", "User");
dialer.DialAsync();

如果您想取消正在进行的连接尝试,您可以调用 dialer.DialAsyncCancel() 。

使用 DotRas 1.2 SDK 进行同步拨号与异步拨号非常相似,只是用 dialer.Dial() 替换 DialAsync 调用。

这是我正在讨论的 API 的链接:http://www.codeplex.com/DotRas

希望这有帮助!

Unfortunately, unless your application can properly terminate the connection that's in progress before exiting the RAS state machine becomes corrupted and must reboot to fix the problem. I've noticed that Windows 7 handles these sorts of scenarios better than XP and Vista did, but there are still occasions when I've had to reboot.

I've managed to prevent most of these sorts of problems with the DotRas API as long as they're occuring in the event handlers of the RasDialer, but if the application crashes from another thread and not from the background thread which raises the RasDialer events, there's nothing I can do about that.

For asynchronous dialing using the DotRas 1.2 SDK:

using DotRas;

RasDialer dialer = new RasDialer();
dialer.EntryName = "My Connection";
dialer.Credentials = new NetworkCredential("My", "User");
dialer.DialAsync();

From this point you can call dialer.DialAsyncCancel() if you want to cancel the connection attempt that's in progress.

For synchronous dialing using the DotRas 1.2 SDK is very similar to asynchronous dialing other than replacing the DialAsync call with simply dialer.Dial().

Here's a link to the API I was talking about: http://www.codeplex.com/DotRas

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文