I have a UDP server/client that sends and receive information. The Client will send example "TEST" to the server, the server will receive "TEST" in a byte[] array representation and convert it to String using the String(byte[]) constructor. I then need to compare the new String received against another string using the equalsIgnoreCase method. But it's not working...
Here's a sample of my code :
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
serverSocket.receive(receivePacket);
//Client sent "TEST"
String sentence = new String(receivePacket.getData(), "UTF-8");
System.out.println("RECEIVED: " + sentence);
System.out.println(sentence.equalsIgnoreCase("TEST")); //This gives me FALSE
Any ideas?
 
     
     
     
     
     
    