03/28/2018, 12:12 PM
@iLobanov the harsh reality is you'll need to understand the protocol you're reading from; there isn't any magical way to know exactly how much data to read- that is encoded in the protocol that you choose to use. For example HTTP works by reading up until two consecutive \r\n characters are read, at which point all the response headers have been read and it should be possible to understand how much data needs to be read.