La domanda e' quanti flush() devo mettere e dove?