System.out.println("Dime el tablero al que te quieres conectar :");
tablero = sc.nextLine(); // AQUI LO LEO COMO UN STRING EN EL CLIENTE
tablero = tablero.trim();
byte buffer_tablero[];
buffer_tablero = tablero.getBytes();
DatagramPacket mensaje_tablero = new DatagramPacket(buffer_tablero, buffer_tablero.length, InetAddress.getLocalHost(), 50000);
puerto.send(mensaje_tablero); // Aqui envio el mensaje con el numero de tablero al que me quiero conectar
//------------------------------------------------------------------------------
puerto.receive(tablero);
buffer = tablero.getData();
datos = new String(buffer, buffer.length); // AQUI PASO A STRING LO QUE RECIBO DEL PAQUETE
System.out.println("He recibido una peticion para el tablero " + datos);
//-------------------------------------------------------------------------------
if (datos.equals("1") || datos.equals("2") || datos.equals("3")) {}
In this if it does not enter me sending from the client any of these 3 values. Debugueando I look at the value of the variable and it has the same value, when it reaches the if it does not enter.