On Sat, 08 Mar 2014 01:42:13 GMT, Etienne Cimon wrote:

Hope it helps!

1) I don't know the length of the data upfront. Normally I would go with this solution but it is broken too as reading in while loop never leaves conn.read()
as it tries to read even if there is nothing. This is broken:

  while (!conn.empty)
  {
    conn.read(buf);  // never leaves
    data ~= buf;
  }

read() should return number of bytes actually read, then say readBuffer() should block until buffer is filled, possibly taking timeout argument.

2) As I mentioned, readLine is a no-go.

3) This is high level logic already, I just want to read the data as client wrote it. And it will not work if client sends less than 150 bytes.

Why is this so difficult? IMHO readAll() is broken. Why would one ever possibly want a connection to close to signalize eof? It is super easy to send conn InputStream back, why is buffering this data so difficult?

Thanks a lot for your answer and suggestions but I think my evaluation is done :(