diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-13 18:05:13 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-13 18:05:13 +0100 |
commit | 947390013409e297cab8ec991212473ae4b76802 (patch) | |
tree | 9cd271a33efd3a2b05154010711bdcd67bdd5e0a /same-android/src/main | |
parent | 585f0a27869c230917c220962e0faf954a283e81 (diff) |
Android Broadcaster implements BroadcastInterface.
Diffstat (limited to 'same-android/src/main')
-rw-r--r-- | same-android/src/main/java/com/orbekk/same/android/net/Broadcaster.java (renamed from same-android/src/main/java/com/orbekk/discovery/Broadcaster.java) | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/same-android/src/main/java/com/orbekk/discovery/Broadcaster.java b/same-android/src/main/java/com/orbekk/same/android/net/Broadcaster.java index 6744651..6e426e8 100644 --- a/same-android/src/main/java/com/orbekk/discovery/Broadcaster.java +++ b/same-android/src/main/java/com/orbekk/same/android/net/Broadcaster.java @@ -1,4 +1,4 @@ -package com.orbekk.discovery; +package com.orbekk.same.android.net; import java.io.IOException; import java.net.DatagramPacket; @@ -10,11 +10,13 @@ import java.net.UnknownHostException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.orbekk.net.BroadcasterInterface; + import android.content.Context; import android.net.DhcpInfo; import android.net.wifi.WifiManager; -public class Broadcaster { +public class Broadcaster implements BroadcasterInterface { private Context context; private Logger logger = LoggerFactory.getLogger(getClass()); private DatagramSocket socket = null; @@ -91,4 +93,10 @@ public class Broadcaster { socket.close(); } } + + @Override + public synchronized boolean sendBroadcast(int port, byte[] data) { + InetAddress broadcastAddress = getBroadcastAddress(); + return sendUdpData(data, broadcastAddress, port); + } }
\ No newline at end of file |