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. |
EPEERERR | 7000 | The peer side has an unrecoverable error and this call has to be cancelled. |
The sendfile method sends certain amount of out of a local file. It is always in blocking mode an neither UDT_SNDSYN nor UDT_SNDTIMEO affects this method. However, the sendfile method has a streaming semantics same as send.
Note that sendfile does NOT nessesarily require recvfile at the peer side. Sendfile/recvfile and send/recv are orthogonal UDT methods.