i currently write a personnal android application which use my wifi
network.
i have a computer that send broadcast tcp information on the ip
239.6.20.71, port 4378.
i can receive event from my java code sample, it's work properly.
but under android nothing !?
this feature is broken?
I use this code under a service through an HandlerThread and
sendBroadcast for each received message.
The code :
public void onCreate() {
try {
InetAddress group = InetAddress.getByName(MULTICAST);
final MulticastSocket socket = new
MulticastSocket(PORT);
socket.joinGroup(group);
byte[] buf = new byte[1000];
final DatagramPacket packet = new DatagramPacket(buf,
buf.length);
HandlerThread handler = new HandlerThread(THREAD_NAME) {
@Override
public void run() {
try {
socket.receive(packet);
String received = new
String(packet.getData());
Intent sended = new
Intent(X10Receiver.ACTION_BROADCAST);
sended.putExtra(X10Receiver.RESULT, received);
sendBroadcast(sended);
} catch (Exception e) {
}
}
};
handler.start();
} catch (Exception e) {
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---