protocol: gurantee that all bytes have been written