The read method on a networkstream blocks only until the first byte is available.
It is not guaranteed to read the desired count into the buffer.
This solution tries to read the remaining bytes in a loop and aborts once the
full count is read or the Stream.Read method returns with 0 or less bytes read.
The synchronous read can block indefinitly if the lenght field is larger than the send package.