wifi - Multicast Support on Android in Hotspot/Tethering mode -
i have prototype android app listening multicast packets 'discover' clients communicate with. socket set similar this:
inetaddress group = inetaddress.getbyname("228.1.2.3"); multicastsocket s = new multicastsocket(4000); s.joingroup(group);
this works when devices connected via wifi. support phone acting portable hotspot. however, while devices appear connect hotspot correctly no longer receive multicast data. i'm wondering if there restrictions disallow type of communication in hotspot mode, or if there additional network configuration required enable this? i've tried on couple different devices running gingerbread , froyo no luck.
as article show: https://plus.google.com/+chainfire/posts/9nmemrkyncd
multicastsocket::setnetworkinterface()
would answer
you can find wlan0 eth :
public static networkinterface getwlaneth() { enumeration<networkinterface> enumeration = null; try { enumeration = networkinterface.getnetworkinterfaces(); } catch (socketexception e) { e.printstacktrace(); } networkinterface wlan0 = null; stringbuilder sb = new stringbuilder(); while (enumeration.hasmoreelements()) { wlan0 = enumeration.nextelement(); sb.append(wlan0.getname() + " "); if (wlan0.getname().equals("wlan0")) { //there better way find ethernet interface log.i(tag, "wlan0 found"); return wlan0; } } return null; }
have try , lemme know if works or not in hotspot mode...
Comments
Post a Comment