Windows 8.1 UDP组播 [英] Windows 8.1 UDP Multicast

查看:359
本文介绍了Windows 8.1 UDP组播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从Windows 8.1上使UDP多播发送到工作中遇到问题.

I'm having a problem getting UDP multicast send to work from Windows 8.1.

以下简单测试程序可在同一主机上运行Windows 7或Ubuntu 13的接口桥接VM内运行.因此,我确定问题不在于java测试程序或物理网络配置.

The following simple test program works from within an interface-bridged VM running Windows 7 or Ubuntu 13 on the same host. For this reason I am sure that the issue is not with the java test program, or with the physical network configuration.

import java.net.*;

public class multicast_send  {
      public static void main(String[] args) throws Exception {
        DatagramSocket socket = null;
        DatagramPacket outPacket = null;

        socket = new DatagramSocket();
        String msg = "Multicast Test";

        outPacket = new DatagramPacket(msg.getBytes(), msg.getBytes().length, InetAddress.getByName("230.0.0.1"), 4446);

        socket.send(outPacket);

        System.out.println("Server sent : " + msg);
        socket.close();
      }
    }

Windows 8.1下的故障表现为静默故障,即消息仅未到达远程主机.

The failure under windows 8.1 manifests itself as a silent failure, i.e. the message just does not arrive at a remote host.

我在Windows 8.1主机上使用了WireShark,但没有发现发送UDP数据包的证据.

I've used WireShark on the Windows 8.1 host and I see no evidence of the UDP packets being sent.

Windows 8.1防火墙已禁用.

The Windows 8.1 firewall is disabled.

我尝试了一系列具有相同结果的多播地址和端口(可在Win7,Ubuntu而非Windows 8.1上运行)

I have tried a range of multicast addresses and ports with the same result (works from Win7, Ubuntu, not Windows 8.1)

通过浏览Internet,我注意到Windows 8.1中引入了对UDP组播问题的一些描述.但是这种情况似乎与问题描述不符.

From browsing the inter-web I notice there are a few descriptions of UDP Multicast issues introduced in Windows 8.1; but this case does not seem to match the issue descriptions.

在所有三种情况下,java环境均为1.7.0.51b13.

The java environment is 1.7.0.51b13 in all three cases.

我是否需要在Windows 8.1中进行一些调整才能启用多播UDP?我没有发现Windows 8.1特有的明显的代码问题吗?

Is there some hidden widget I need to tweak in Windows 8.1 to enable Multicast UDP? Is there a glaringly obvious code problem I'm not spotting which is Windows 8.1 specific?

推荐答案

解决方案是Windows 8.1可以访问多个接口,以太网适配器和多个VM桥接适配器.

The solution is that windows 8.1 has access to more than one interface, the Ethernet adapter and multiple VM bridging adapters.

类似于其他win8.1 UNDP问题的解决方案,似乎与其他OS不同,没有为UDP发送选择默认接口,因此成功的多播依赖于显式分配套接字接口.

Similar to the resolution to other win8.1 UNDP issues, it appears that unlike other OS, there is no default interface selected for the UDP send, so successful multicast relies on assigning explicitly an interface to the socket.

Socket.setinetrface.getbyname(以太网适配器的IP地址")

Socket.setinetrface.getbyname("ip address of Ethernet adapter")

一旦我这样做,它就会按预期工作.

As soon as I do that, it works as expected.

这篇关于Windows 8.1 UDP组播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆