Write interface.
returns 0 on success, -1 on error; forces a write of still unwritten data.
returns the number of bytes written; tries to write all of buf.
See Implementation
Write interface.