diff options
-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 |