The sendfile method sends out part or the whole of a local file.
On success, sendfile returns the actual size of data that has been sent. Otherwise UDT::ERROR is returned and specific error information can be retrieved by getlasterror.
| Error Name | Error Code | Comment |
| ECONNLOST | 2001 | connection has been broken. |
| ENOCONN | 2002 | u is not connected. |
| EINVOP | 4000 | File or disk system errors. |
| EINVSOCK | 5004 | u is not an valid socket. |
| EDGRAMILL | 5010 | cannot use sendfile in SOCK_DGRAM mode. |
The sendfile method sends certain amount of out of a local file. It is always in blocking mode and will not return until the exact amount of data is sent, EOF is reached, or the connection is broken. Neither UDT_SNDSYN nor UDT_SNDTIMEO affects this method.
Note that sendfile does NOT nessesarily require recvfile at the peer side. Send/recvfile and send/recv are orthogonal UDT methods.