public void close() throws IOException {
  if (connection != null) {
    connection.close();
    connection=null;
  }
}

public void close ( ) throws IOException { if ( connection != null ) { connection . close ( ) ; connection = null ; } }
close the datagram connection
