@Override public void run(){
  try {
    while (alive) {
      try {
        packet.setLength(buffer.length);
        socket.receive(packet);
        String s=stringFromPacket(packet);
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException ex) {
        }
        stringToPacket(s.toUpperCase(),packet);
        packet.setAddress(InetAddress.getLocalHost());
        packet.setPort(2345);
        socket.send(packet);
      }
 catch (      java.io.InterruptedIOException e) {
      }
    }
  }
 catch (  java.io.IOException ex) {
    ex.printStackTrace();
  }
 finally {
    socket.close();
  }
}

@ Override public void run ( ) { try { while ( alive ) { try { packet . setLength ( buffer . length ) ; socket . receive ( packet ) ; String s = stringFromPacket ( packet ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException ex ) { } stringToPacket ( s . toUpperCase ( ) , packet ) ; packet . setAddress ( InetAddress . getLocalHost ( ) ) ; packet . setPort ( 2345 ) ; socket . send ( packet ) ; } catch ( java . io . InterruptedIOException e ) { } } } catch ( java . io . IOException ex ) { ex . printStackTrace ( ) ; } finally { socket . close ( ) ; } }
main loop . receives datagrams and reflects them .
