You can create your own application that can keep track of the received packets/data and when it reaches a predefined value (can be dynamic from e.g. the first packet it received) it will start the sending.
Study how example applications such as UdpEchoServer works, how it handles receiving packets and just use your brain to design the functionality you described.
To answer your questions
1) Simply count the number of data from received packets
2) The principle is the same. The trigger will be different, instead of time, it will be the number of received data. The simplest implementation is an 'if - then' statement.
Regards,
K