Java tutorial
import java.net.DatagramPacket; import java.net.DatagramSocket; public class Main { static final int BUFFERSIZE = 256; public static void main(String[] args) throws Exception { DatagramPacket pack = new DatagramPacket(new byte[BUFFERSIZE], BUFFERSIZE); DatagramSocket sock = new DatagramSocket(7); // echo back everything while (true) { sock.receive(pack); sock.send(pack); } } }