Appeal before the next serve is hit. For the shot that ends the match, appeal before the scoresheet is initialed.