[ace-users] ACE_OS::sendv() behavior question concerning partial writes

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Fri Aug 24 10:18:31 CDT 2007

Hi Olivier,

To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form (PRF),
which is in


or in


in older versions of ACE+TAO.  Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness.  If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers

> By looking at the ACE::sendv_n_i() code, I have found out that
> writev() can perform partial writes. I am surprised of that behavior
> because in the book Unix network programming vol. 1, second edition,
> it is written that writev() is an atomic operation. 

I don't think that's correct.  Please see the official documentation for
writev() at 


and look at this statement:

"Upon successful completion, writev() shall return the number of bytes
actually written. Otherwise, it shall return a value of -1, the
file-pointer shall remain unchanged, and errno shall be set to indicate
an error."

> My understanding of what an atomic operation is, is that it either
> writes all the data or it does not write anything but obviously in the
> writev() context, atomic operation means something else.

Can you please provide the quote from the UNPv1 book that you're
referring to?

> So I would like to ask this group what atomic operation means for
> writev() and besides if ACE_IOV_MAX is defined what are the conditions
> with a non blocking stream socket that could result in a writev()
> partial write?

I suspect it's the usual suspects, e.g, a flow controlled connection
that leads to "short writes".  Please see


for a summary of why short writes can occur.



More information about the Ace-users mailing list