Add Read/WriteMessageN to return number of bytes.

This commit adds two new funtions named ReadMessageN and WriteMessageN
which return an additional paramter for the number of bytes read or written,
respectively.

It also adds tests to ensure the number of bytes read and written are the
expected values both for successful reads/writes and unsuccessful ones.

Closes #6.