【发布时间】:2015-10-23 21:44:19
【问题描述】:
我在笔记本电脑上使用 Ubuntu 14.04 LTS 来托管 Windows 7 VirtualBox 实例。我想要做的是将笔记本电脑连接到网络(有线或无线),然后在连接到 IPv4 多播的 Windows VM 中运行应用程序。该应用程序是用 Qt 4.8.2 编写的,我在 QtCreator 中运行它。当我运行应用程序时,它无法加入多播组:
QUdpSocket *udpSocket = new QUdpSocket(this);
bResult = udpSocket->bind(port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
bResult = udpSocket->joinMulticastGroup(address);
如果我进入 joinMulticastGroup(),我可以看到 setsockopt() 返回 -1。此代码在本机 Windows 中运行良好。我尝试将 VM 网络连接到 NAT 或将桥接网络连接到 eth0(混杂模式设置为全部允许),但都不起作用。
VirtualBox 是不允许这样做,还是需要在 VM 或 Linux 主机上调整某些设置?
注意:我无法在 Linux 中运行 Qt 应用程序,因为它依赖于仅为 Windows 构建的第三方库。
【问题讨论】:
标签: linux windows qt virtualbox multicast