Is CHANGE_WIFI_MULTICAST_STATE permission and use of WifiManager.MulticastLock required to receive multicast packets on Android? -


i have test app i'm using demonstrate whether or not multicast traffic making android device. i'm seeing behavior appears contradict google's documentation here , here implies 2 prerequisites need in place in order app receive multicast traffic:

  1. acquire multicastlock
  2. add change_wifi_multicast_state permission app's manifest

my app able receive multicast traffic without either of these items in place. below code snippet sets multicast socket receiving data.

multicastsocket multicastreceivesocket = new multicastsocket( 18200 ); multicastreceivesocket.joingroup( inetaddress.getbyname( "232.232.232.232" ) );  byte[] buffer = new byte[ 65536 ]; datagrampacket packet = new datagrampacket( buffer, buffer.length ); multicastreceivesocket.receive( packet ); 

should happening? should able receive multicast packets without either of 2 prerequisites in place? noticed multicastlock documentation says:

normally wifi stack filters out packets not explicitly addressed device

does mean behavior different 1 device another? i'm testing app on samsung galaxy note4 (model sm-n910t) running android version 4.4.4. clarification on issue appreciated.

wifimanager.multicastlock when acquired, modify state of wifi interface on device (gobally), allow apps receive multicast traffic. app need change_wifi_multicast_state permission if app wants acquire lock.

in case, if multicast traffic received without acquiring lock, must mean either

(1) other app has acquired lock, due which, interface parsing/filtering , delivering multicast packets also.

or

(2) manufacturer of device ignored android api while developing device, , interface delivers multicast traffic.

the description of api not force manufacturers allow multicast traffic when app has acquired lock.

regardless, apps must acquire lock if want reliably receive multicast traffic.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -