RNDIS 丢失连接/滞后问题
我们有一个用 C# 编写的临时 SOAP 客户端,从 Windows 移动设备连接到桌面上的 CXF 服务。当该设备通过 ActiveSync 连接时,它会为 RNDIS 连接创建一个虚拟适配器。该虚拟适配器将网关 IP 分配给主机 169.254.2.2
。
当我们尝试使用 C# 客户端中设置的主机名或主机 IP 地址进行连接时,一切正常。然而,当我们将 IP 设置为 RNDIS 网关 (169.254.2.2
) 时,服务器端的连接会定期丢失。 CXF 服务不断尝试连接,并最终成功,但这会导致连接速度大幅减慢。我们的移动 C# 端日志中没有报告错误,仅在 CXF 服务器上报告错误。
有谁知道为什么会发生这种情况?在排除之前,我们需要断言 169.254.2.2
不可能用作有效端点。
哦,如果有帮助的话,在 ActiveSync 连接后,C# 客户端将通过 DHCP 被授予 IP 169.254.2.1
。
We have a makeshift SOAP client written in C# connecting to a CXF service on a desktop from a windows mobile device. When this device is connected via ActiveSync, it creates a virtual adapter for the RNDIS connection. This virtual adapter assigns a gateway IP to the host, 169.254.2.2
.
When we attempt to go through the connection with the hostname or the host's IP set as the address in the C# client, everything works perfectly. When we however set the IP to be the RNDIS gateway (169.254.2.2
), the connection is periodically lost on the server side. The CXF service keeps trying to connect, and eventually succeeds, but this results in a massive slowdown of the connection. There are no errors reported in our logs on the mobile C# side, only on the CXF server.
Does anyone have any clues as to why this is happening? We need to assert that 169.254.2.2
cannot possibly be used as a valid endpoint before we rule it out.
Oh, and in case it helps, the C# client is granted the IP 169.254.2.1
through DHCP after the ActiveSync connection.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想到的第一个问题是,尤其是当我看到您正在使用 DCHP 时,来自 DHCP 服务器的 IP 的租约时间即将到期,并且 CXF 服务器必须等待 DCHP 服务器发出新的租约。
如果您知道 IP 不会更改,请尝试延长 DCHP 租约,并在可能的情况下使用静态 IP。这至少会消除那个故障点。
The first issue that comes to my head, especially once I saw that you are using DCHP, is that the lease time on the IP from the DHCP server is expiring and the CXF server is having to wait for the DCHP server to issue a new lease.
Try lengthening the DCHP lease if you know that the IP won't be changing and use a static IP if you are able. That will at least remove that point of failure.
我找到了这个问题的原因,但我对回答感到不好意思,因为我怀疑其他人是否能猜到这是问题所在:
在我们的 CXF 服务器上,我们调用了
InetAddress.getHostName()
它基本上对 C# 客户端发送的请求进行反向 DNS 查找。当使用 ActiveSync IP 地址时,DNS 中没有 169.254.2.1 的条目(当然),因此 java 类将挂起,直到该方法超时(大约需要 20 秒才能将响应写入 C# 客户端) )。每个请求需要 20 秒,这会导致速度大幅下降并出现连接丢失错误。
我们通过将调用移至半秒后强制完成的执行程序线程来修复此问题。因为它在另一个线程中,所以速度减慢变得不存在。很高兴一切都结束了!
I found out the cause of this, but I feel bad for answering because I doubt there was any way someone else could have guessed that this was the problem:
On our CXF server, we have a call to
InetAddress.getHostName()
which basically does a reverse DNS lookup on the request sent from the C# client.When using the ActiveSync IP address, there was no entry in the DNS for 169.254.2.1 (of course), so the java class would hang until the method timed out (which took about 20 seconds before it would write a response to the C# client). At 20 seconds per request, this resulted in the massive slowdown and lost connection errors.
We fixed this by moving the call to an executor thread that force-finished after half a second. Because it was in another thread, the slowdown became nonexistent. Glad to have that over with!