Fix a buffer length issue

Fix a buf where NetLibClient would attempt to read the entire buffer,
rather than simply the part of the buffer that has been written to.
This also improved performance of the NetLibServer.