import java.net.*; import java.io.*; class echoOutputThread extends Thread { DatagramSocket theSocket; protected DatagramPacket dp; public echoOutputThread(DatagramSocket s) { theSocket = s; byte[] buffer = new byte[65507]; dp = new DatagramPacket(buffer, buffer.length); } public void run() { while (true) { try { theSocket.receive(dp); String s = new String(dp.getData(), 0, 0, dp.getLength()); System.out.println(s); Thread.yield(); } catch (IOException e) { System.err.println(e); } } } }