组播功能的Andr​​oid 2.2组播、功能、Andr、oid

2023-09-12 11:11:36 作者:时光留下最真的人

有没有人得到多播工作在Android 2.2系统,专为JmDNS Bonjour服务检测。有许多问题和放大器;从Android 1.5> 2.0的时间内,包括计算器,这表明不同程度的成功,并在bug跟踪系统,表明它是固定的,和关闭,对2.2中的错误(http://$c$c.google.com/p/android/issues/detail?id=2323)我已经尝试了TuneControl源$ C ​​$ C,但曾在〜1.5,一直没有更新,对我来说在2.2不起作用。

Has anyone gotten Multicast to work on Android 2.2, specifically JmDNS for Bonjour service detection. There are many questions & answers from the Android 1.5->2.0 timeframe, including on stackOverflow, that indicate varying levels of success, and a bug in the bug tracker that indicate it was fixed, and closed, for 2.2 (http://code.google.com/p/android/issues/detail?id=2323) . I've tried the "TuneControl" source code, but that worked on ~1.5 and has not been updated, and does not work for me on 2.2.

所以,问题... 1)拥有的任何的看到组播2.2工作,特别是JmDNS,以及专为Bonjour服务检测?

So, the questions... 1) Has anyone seen multicast work on 2.2, specifically JmDNS, and specifically for Bonjour service detection?

2)什么是必要的,code,使这项工作?

2) What is necessary in code to make this work?

我使用了适当的权限:

<使用-权限的Andr​​oid:名称=android.permission.CHANGE_WIFI_MULTICAST_STATE/>

<uses-permission android:name="android.permission.INTERNET"/>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

我获得组播锁:

I acquire the multicast lock:

WifiManager wifi = (WifiManager)getSystemService( Context.WIFI_SERVICE );
if(wifi != null)
{
    MulticastLock mcLock = wifi.createMulticastLock("mylock");
    mcLock.acquire();
...

然后再尝试启动jmDNS寻找服务器:

And then try to start jmDNS to look for servers:

    mdns = JmDNS.create(addr, HOSTNAME);
    jmdns.addServiceListener(TOUCH_ABLE_TYPE, listener);
    jmdns.addServiceListener(DACP_TYPE, listener);
    ...

监听器永远不会看到任何服务。我已经使用Wireshark的,该请求报文发送验证,服务器响应,但响应数据包都从未见过的监听套接字code在jmDNS库。

The listener never sees any services. I've verified using Wireshark that the request packets are sent, and that the server responds, but the response packet are never seen by the socket listener code in the jmDNS library.

所以...我失去了一些东西?这仍然是一个错误?有没有人得到任何东西,甚至远程喜欢这个工作???

So... am I missing something? Is this still a bug? Has ANYONE gotten anything even remotely like this to work???

推荐答案

要(粗暴地)回答我的问题,更多的信息,在http://$c$c.google.com/p/android/issues/detail?id=2917#c48由另一人。对于后人,正如他们所说,这里是brian.ro ... @ gmail.com的答案...

To (rudely) answer my own question, more information was provided at http://code.google.com/p/android/issues/detail?id=2917#c48 by another person. For posterity, as they say, here is brian.ro...@gmail.com's answer...

我花了相当多的时间   调试的mDNS问题上JmDNS我   埃沃和HTC HERO(CDMA)。我发现   是似乎有在过滤器   放置在Broadcom无线驱动程序   在埃沃(和因为我得到一个   从HTC Desire的用户similiar reprt    - 使用相同的芯片组,presumably的听筒以及)。该过滤器,由   默认情况下,阻止任何非单播或   网络广播流量,包括   多播。显然,理论是   这是一个电池保护程序。

"I've spent quite a bit of time debugging mDNS issues with JmDNS on my Evo and HTC Hero (CDMA). What I found is there appears to be a filter in place in the broadcom wireless driver on the Evo (and since I'm getting a similiar reprt from an HTC Desire user - with the same chipset, presumably that handset as well). The filter, by default, blocks any non-unicast or network broadcast traffic, including multicast. Apparently the theory was it's a battery saver.

的问题似乎是   wpa_supplicant提供的埃沃不   支持消除这些过滤器时,   你会得到一个MulticastLock。 (检查   日志输出之后,你得到的   锁定你会明白我的意思)。   不幸的是发生了什么事是   硬件供应商已经支离破碎   组播支持.... :(

The problem appears to be the wpa_supplicant on the Evo does not support removing those filters when you get a MulticastLock. (Check the log output right after you get the lock and you'll see what I mean). Unfortunately what has happened is the hardware vendors have fragmented multicast support.... :("

所以......看来这是一个设备问题多了编码问题。 D'哦。 :(如果我得到一个机会来测试在另一台设备...

So... it appears this is a device problem more than a coding problem. D'oh. :( If I get an opportunity to test on another device...