|
|
@@ -49,20 +49,14 @@ public class WifiCommunication { |
|
|
|
try { |
|
|
|
do { |
|
|
|
byte[] receiveData = new byte[512]; |
|
|
|
InetAddress fromAdress; |
|
|
|
int fromPort; |
|
|
|
DatagramPacket rxPacket = new DatagramPacket(receiveData, receiveData.length); |
|
|
|
socket.receive(rxPacket); |
|
|
|
fromAdress = rxPacket.getAddress(); |
|
|
|
fromPort = rxPacket.getPort(); |
|
|
|
rxString = new String(rxPacket.getData()); |
|
|
|
if(!previousRxString.equals(rxString)) { |
|
|
|
rxStringBuffer.append(rxString).append("\n"); |
|
|
|
mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer)); |
|
|
|
previousRxString = rxString; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} while (running); |
|
|
|
} |
|
|
|
catch (IOException e) { |