Replace Write::write() with Write::write_all()
The former does not guarantee the whole buffer is written; instead it returns how many bytes were written and expects the caller to try again
The former does not guarantee the whole buffer is written; instead it returns how many bytes were written and expects the caller to try again