La risposta è in un'altra sezione del man 2 send
:
When the message does not fit into the send buffer of the socket,
send() normally blocks, unless the socket has been placed in nonblock‐
ing I/O mode. In nonblocking mode it would fail with the error EAGAIN
or EWOULDBLOCK in this case. The select(2) call may be used to deter‐
mine when it is possible to send more data.
O, in alternativa, la versione POSIX (man 3p send
):
If space is not available at the sending socket to hold the message to
be transmitted, and the socket file descriptor does not have O_NONBLOCK
set, send() shall block until space is available. If space is not
available at the sending socket to hold the message to be transmitted,
and the socket file descriptor does have O_NONBLOCK set, send() shall
fail. The select() and poll() functions can be used to determine when
it is possible to send more data.
Così, mentre un read
dei dati parziali è comune , un parziale send
in modalità di blocco non dovrebbe avvenire (salvo i dettagli di implementazione).
fonte
2012-09-29 22:32:22
-1: Esattamente all'indietro - per qualsiasi protocollo basato sul flusso (come TCP), l'invio può restituire meno dell'importo richiesto, se il buffer locale è quasi pieno già dalle mandate precedenti. Per i protocolli dei datagrammi (come UDP), l'invio fallirà o invierà l'intero buffer come pacchetto - non sono possibili mandate parziali. –
Non ho sottovalutato, ma vedi la mia risposta, ti sbagli. –
@ Kiril Kirov - tu e Chris Dodd assolutamente corretti. Brain Fart da parte mia - scuse. Ho corretto la mia risposta. Grazie! – paulsm4