import java.net.*;
import java.io.*;

public class UdpEchoServer {
  static final int BUFFERSIZE = 256;
  public static void main(String [] args) {
    DatagramSocket sock;
    DatagramPacket pack=new DatagramPacket(
      new byte[BUFFERSIZE],BUFFERSIZE);
    try {
      sock=new DatagramSocket(7);
      }
    catch (SocketException e) {
      System.out.println(e);
      return;
      }
// echo back everything
    while (true) {
      try {
        sock.receive(pack);
        sock.send(pack);
        }
      catch (IOException ioe) {  
        System.out.println(ioe);
        }
      }
   }
}
