Typically, you need to figure out what constitutes a packet, and write code to buffer incoming data until the end of packet marker arrives.
So, you would use:
while(Serial.available() > 0)
{
// read and buffer any non-end-of-packet marker characters
// if a character read IS an end of packet marker, set a flag and break out of the while loop
}
// If the end-of-packet marker arrived flag is set, the buffer contains usable data.
You would need to just print any available data (in hex, perhaps) to see what, if anything, is used as the end of packet marker, or to see if there is a packet size value sent.
Reading random serial data is not a trivial task.