It is not a failure yet if send()
actually sends less bytes han requested. I suppose your errno
happend earlier.
If i4RetVal < u2BufLen
you should just continue sending after advancing your "send cursor" by i4RetVal
and reducing the buf length (better: the length to be sent) by the same amount.
Continue doing so until you really have sent everything.
You only should check for errors if i4RetVal < 0
.