How to clear SoftwareSerial values?
For the hardware serial port, the buffer is 64 and I was reading at least 100 times. Every read will clear one byte of data from the serial buffer at a time.
For the software serial port, you do a dummy read and then check whether the buffer is empty or not using
    while(mySerial.available()&gt;0)  {  
       dummy = mySerial.read();  
    }

So, in summary, you have to read the buffer until it is empty.
Useful notes:

You should be knowing when to expect actual data and when not to
have a way to identify the valid messages (some fixed header bytes)
have a way to validate the contents (checksum)

Leave a comment if you have any questions