What does that mean? Your client is suicidal?
Are you sure? send() returns >0 if something was sent - but that doesn't mean everything was sent. If the return value == the length you passed send(), then everything was sent. Otherwise, only part of it was sent.1. Server trying to send n msg and all sucess (means send return > 0)
No. send() returns <0 on error, not on buffer full. Read the man page. Now, if you're using nonblocking sockets, send() might return <0, and errno set to EAGAIN/EWOULDBLOCK.2. when send return < 0, it should be the buffer is full.
Read the man page for send. Basically, for non-blocking sockets:3. Although the previous is return < 0, somehow after calling send again, it return > 0. It should be return < 0 because client doesn't call recv
- send() returns >0: The return value is the number of bytes sent. Check it: it might be what you passed to send, it might be less.
- send() returns <0: Some error occurred. One of the possible 'errors' with nonblocking sockets is 'EWOULDBLOCK' (errno is set to this) - the socket couldn't fulfill your request, but didn't want to block, so it returned. No data was sent, and you'll need to wait for the socket to be available to send data on it.
Note: If you're using Winsock, EWOULDBLOCK is reported differently.