Read (and process) all datagrams in a loop, until none is received within a time interval. A non-blocking socket and select.select can be used with a timeout to accomplish this.