If the delimiter and the max_length are reached
at the same time, the delimiter will not be part of the captured
data. Of only part of the delimiter has been received, then the
part of the delimiter we have received, will be part of the capture data.
When
the max_length is changed, any data currently in the buffer will
be thrown away, and the new value of max_length will be used.