I need to create a 10 second timeout on this part of the code
DatagramPacket getack = new DatagramPacket(incoming, incoming.length); socket.rece
That should work for your example.
socket.setSoTimeout(10000); while(true) { DatagramPacket getack = new DatagramPacket(incoming, incoming.length); try { socket.receive(getack); } catch (SocketTimeoutException e) { // resend socket.send(data); continue; } // check received data... }