If you don't have a constant terminator, or your data is not ASCII, you will probably just have to set a timeout that is long enough to cover receiving the longest possible string.