Reputation: 387
In socket communication:
In blocking mode, send()
will return the number of byte sent, then I have to repeat send()
until all data has been sent or socket error.
In non-blocking mode, send()
will return with EAGAIN/EWOULDBLOCK error if it cannot send all data immediately, then, I will select()
on writefds param until I have the signal.
My questions:
select()
for all data? (not partial).select()
as socket failure?Upvotes: 0
Views: 1597
Reputation: 310957
In non-blocking mode,
send()
will return with EAGAIN/EWOULDBLOCK error if it cannot send all data immediately
If it cannot send any data immediately.
- Is the signal from select() for all data? (not partial).
All what data? What does select()
know about your data? All that it is telling you is that the socket has now become writable, which means there is some space in the kernel socket send buffer, which means that a send()
will now transfer at least one byte.
- Is the error from select() as socket failure?
If select()
returns -1, there is either an error in the parameters or an invalid FD supplied to one of the select sets: typically, one that has been closed.
Upvotes: 1