Multicast support in Android 2.2?

Does Android 2.2 media support IGMP / Multicast? If so, can someone explain how we can do this?

+3
source share
2 answers

It is pretty simple:

  • Tell wifimanager that your application should receive multicast:

    WifiManager wifi = (WifiManager)getSystemService( Context.WIFI_SERVICE );
    MulticastLock mcLock = wifi.createMulticastLock("mylock");
    mcLock.acquire();
    
  • Create a socket:

    InetAddress group = InetAddress.getByName(MULTICAST_ADDRESS);
    MulticastSocket s = new MulticastSocket(MULTICAST_PORT);
    s.joinGroup(group);
    
0
source

Android multicast support doesn't seem to be as reliable as some of them might hope. See http://codeisland.org/2012/udp-multicast-on-android/

That is, whether it really works or may be device dependent. It does not work on my Nexus5.

https://code.google.com/p/android/issues/detail?id=51195

0

Source: https://habr.com/ru/post/1765613/


All Articles