|
|
@@ -9,6 +9,8 @@ import java.net.InetAddress; |
|
|
|
import java.net.NetworkInterface; |
|
|
|
import java.net.SocketException; |
|
|
|
import java.net.UnknownHostException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Enumeration; |
|
|
|
|
|
|
|
public class WifiCommunication { |
|
|
@@ -27,7 +29,7 @@ public class WifiCommunication { |
|
|
|
try { |
|
|
|
socket = new DatagramSocket(this.port); |
|
|
|
socket.setBroadcast(true); |
|
|
|
address = InetAddress.getByName("10.0.2.255"); //100.82.255.255 |
|
|
|
address = InetAddress.getByName("255.255.255.255"); //100.82.255.255 |
|
|
|
running = true; |
|
|
|
send = false; |
|
|
|
new ReceiveThread().start(); |
|
|
@@ -77,8 +79,11 @@ public class WifiCommunication { |
|
|
|
if(send) |
|
|
|
{ |
|
|
|
send = false; |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); |
|
|
|
Date curDate = new Date(System.currentTimeMillis()); |
|
|
|
String str = formatter.format(curDate); |
|
|
|
byte[] send_Data = new byte[512]; |
|
|
|
String txString = (getLocalIpAddress() + " sends:" +messageToSend+ " Count: " + tmpCnt++); |
|
|
|
String txString = (str+ ",Gruppe2," + getLocalIpAddress() + ",An,Video," +messageToSend); |
|
|
|
send_Data = txString.getBytes(); |
|
|
|
|
|
|
|
DatagramPacket txPacket = new DatagramPacket(send_Data, txString.length(), address, port); |