如何使用 SIO_GET_INTERFACE_LIST 控制代码对 WSAIoctl 返回的网络接口重新排序

发布于 2024-08-15 01:32:51 字数 1149 浏览 2 评论 0原文

有没有办法指定 Win32 WinSock WSAIoctl 函数的 SIO_GET_INTERFACE_LIST 功能返回的网络接口的顺序?

背景:

我们有一个异构 CORBA 系统,其中在 Windows 上运行 ACE/TAO CORBA 实现的名称服务注册了基于 ACE/TAO 的服务,使用 IIOP.NET CORBA 实现实现的客户端需要使用这些服务。基于 IIOP.NET 的客户端位于单独的 Windows 计算机上。 ACE/TAO 计算机具有多个网络接口(客户端计算机只能访问其中之一),因此具有多个 IP 地址。

IIOP.NET 客户端可以连接到名称服务并检索它需要使用的已注册服务器 CORBA 对象的代理,但当它尝试使用该代理时,它会引发异常。

基于花费太多时间进行调试,我们得出的结论是,问题在于 IIOP.NET 仅尝试连接到名称服务在请求服务时返回的 CORBA IOR 字符串中的第一个 IP 地址。 IOR 字符串是对象的描述,包括其 IP 地址。大多数 CORBA 客户端将尝试使用 IOR 字符串中的所有地址与服务器对象连接,但 IIOP.NET 似乎不会这样做。

生成 IOR 字符串的 ACE/TAO 代码使用 WinSock WSAIoctl 命令和控制代码 SIO_GET_INTERFACE_LIST 返回盒子上的网络接口列表,然后将它们全部添加到IOR 字符串。问题是第一个 IP 地址不在 IIOP 客户端使用的网络上,因此当 IIOP.NET 客户端尝试使用该 IP 地址连接到服务器对象时,它显然会失败,并且永远不会尝试使用该 IP 地址。正确的IP地址。其他 CORBA 客户端(例如 ACE/TAO)会尝试所有 IP 地址,并且它们在此配置中工作。

由于我不是网络/CORBA 大神,因此尝试更改 ACE/TAO 或 IIOP.NET 对我来说是不现实的,并且我们有充分的理由在该系统中拥有两个独立的网络,但如果第一个网络是默认 IP WSAIOCtl 返回的地址是客户端需要的地址,这将解决问题,因为该 IP 地址将成为 IOR 字符串中的第一个 IP 地址,并且 IIOP.NET 将成功使用该 IP 地址。那么,是否有一种可靠的方法可以使 WSAIoctl 以不同的顺序返回网络接口?不幸的是,我在 MSDN 上没有看到任何关于此的记录。

谢谢,

戴夫

Is there a way to dictate the order of the network interfaces returned by the Win32 WinSock WSAIoctl function's SIO_GET_INTERFACE_LIST functionality?

Background:

We've got a heterogeneous CORBA system where a nameservice running the ACE/TAO CORBA implementation on Windows has ACE/TAO-based services registered with it that clients implemented using the IIOP.NET CORBA implementation need to use. The IIOP.NET-based clients are on a separate Windows machine. The ACE/TAO machine has multiple network interfaces (only one of which is accessible by the client machine) and therefore multiple IP addresses.

The IIOP.NET client can connect to the nameservice and retrieve a proxy to the registered server CORBA object that it needs to use, but when it tries to use the proxy it throws exceptions.

Based on way too much time spent debugging, we've come to the conclusion that the problem is that IIOP.NET only attempts to connect to the first IP address in the CORBA IOR string that the name service returns when asked for the service. The IOR string is a description of the object, including its IP address(es). Most CORBA clients will attempt to connect with the server object using all the addresses in the IOR string, but it looks like IIOP.NET doesn't do that.

The ACE/TAO code that generates the IOR string uses the WinSock WSAIoctl command with the control code SIO_GET_INTERFACE_LIST to return the list of network interfaces on the box and then adds them all to the IOR string. The problem is that the first IP address is the one that is not on the network that the IIOP client uses, so when the IIOP.NET client tries to connect to the server object using that IP address it obviously fails and never tries to use the correct IP address. Other CORBA clients such as ACE/TAO do try all the IP addresses and they work in this configuration.

Since I'm not a networking/CORBA god, it's not realistic for me to attempt to change ACE/TAO or IIOP.NET, and we have good reasons to have two, separated networks in this system, but if the first, default IP address returned by WSAIOCtl were the one that the client needs, that would solve the problem since that IP address would then become the first IP address in the IOR string and IIOP.NET would use that IP address successfully. So, is there a reliable way to cause WSAIoctl to return the network interfaces in a different order? I don't see anything documented on MSDN on this, unfortunately.

Thanks,

Dave

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

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

发布评论

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

评论(1

终难愈 2024-08-22 01:32:51

我找到了解决方案,并提供答案,以防其他人遇到此问题。 ACE/TAO orb 有一个命令行参数,可让您覆盖 WSAIoctl 返回的结果。命令行参数是 -ORBListenEndpoints,它允许您提供以分号分隔的主机名和 IP 地址列表。 Google -ORBListenEndpoints 你会找到确切的语法。使用接收该命令行参数的 ORB 初始化的任何服务器都将侦听指定端点。我已经测试过这个并且它有效。

I found the solution and I'm providing the answer in case anyone else comes up against this. The ACE/TAO orb has a command-line parameter that lets you override the results returned by WSAIoctl. The command-line parameter is -ORBListenEndpoints and it allows you to provide a semicolon-delimited list of host names and IP addresses. Google -ORBListenEndpoints and you'll find out the exact syntax. Any servers initialized with the ORB receiving that command line parameter will listen on the specified endpoint(s). I've tested this and it works.

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