如何诊断 Windows CE 上的 WSAECONNREFUSED 错误?

发布于 2024-11-16 15:14:46 字数 510 浏览 1 评论 0原文

我有一台连接到 Dell Latitude E6500 笔记本电脑的 Dell Axim Windows CE 设备(Windows Mobile 5.0 OS 5.1.1702 Build 14366.1.0.1)。我的 C++ 应用程序正在 CE 设备上运行,并侦听端口 80 上的 TCP 连接。该程序尝试使用地址 169.254.2.1:80 连接到自身,并收到错误代码 WSAECONNREFUSED (10061)。这通常表明没有人在侦听该端口。如果我将地址更改为127.0.0.1:80,则连接成功。

这是奇怪的部分。如果我断开设备与笔记本电脑的连接并将其连接到 Dell Latitude D830,则一切正常。 169.254.2.1 地址相同,但连接成功。请注意,这是在 CE 设备上运行的应用程序连接到自身,而不是连接到笔记本电脑,也不是笔记本电脑连接到设备上的应用程序。我们已经用几台不同的机器证实了这一点 - 所有 E6500 都显示了该问题,其他机器都没有。

我不明白设备连接到哪台机器如何影响内部 TCP 连接。有什么想法吗?

I have a Dell Axim Windows CE device (Windows Mobile 5.0 OS 5.1.1702 Build 14366.1.0.1) connected to a Dell Latitude E6500 laptop. My C++ application is running on the CE device and listening for TCP connections on port 80. The program tries to connect to itself using the address 169.254.2.1:80, and gets error code WSAECONNREFUSED (10061). This generally indicates that nobody is listening on that port. If I change the address to 127.0.0.1:80, the connection succeeds.

Here's the weird part. If I disconnect the device from that laptop and connect it to a Dell Latitude D830, everything works properly. The 169.254.2.1 address is the same, but connecting to it succeeds. Note that this is the application running on the CE device connecting to itself, not connecting to the laptop, nor is it the laptop connecting to the application on the device. We have confirmed this with a few different machines - all of the E6500's show the problem, nothing else does.

I don't understand how which machine the device is connected to affects internal TCP connections. Any ideas?

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

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

发布评论

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

评论(1

滥情空心 2024-11-23 15:14:46

首先我要问你为什么使用 169.254.2.1 来连接到自己。该 IP 地址是 ActiveSync 分配的地址,并且不能保证是静态的(过去,当驱动程序从 USB 串行转到 RNDIS 时,它实际上确实改变过一次),因此使用它是有风险的。

如果您想为自己寻址,请使用标准环回地址,例如 127.0.0.1。如果您想要寻址 activesync 合作伙伴,请解析主机名 ppp_peer 并让它为您提供实际地址。

我对该行为的来源的猜测是,当您连接到 PC 时,会使用两个节点(设备和 PC)构建本地“LAN”。该 LAN 往往不是一个“完整”网络(例如,ICMP 数据包不会被传输),并且它可能取决于主机 PC 加载的驱动程序。当然,这纯粹是猜测。

正如我所说,我想更多地了解您为什么使用您要使用的地址,看看我们是否可以通过做一些更安全的事情来“解决”这个问题。

First I have to ask why you're using 169.254.2.1 to connect to yourself. That IP address is an ActiveSync-assigned address, and it's not guaranteed to be static (it actually did change once in the past, when the driver went from USB serial to RNDIS) so using it is risky.

If you want to address yourself, use a standard loopback address like 127.0.0.1. If you want to address an activesync partner, resolve the host name ppp_peer and let that give you the actual address.

My guess as to the source of the behavior is that when you connect to the PC, a local "LAN" is built with two nodes (the device and the PC). That LAN tends to not be a "full" network (for example ICMP packets don't get transmitted) and it's probably dependent on the driver loaded by the host PC. That's purely speculation, of course.

As I said, I'd like to know more about why you're using the address you are to see if we can "fix" the issue by doing something that's altogether a bit safer.

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