The recvfile method reads certain amount of data into a local file.
On success, recvfile returns the actual size of received data. 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 and no data left in receiver buffer. |
ENOCONN | 2002 | u is not connected. |
EFILE | 4000 | File or disk system errors. |
EINVSOCK | 5004 | u is not an valid socket. |
EDGRAMILL | 5010 | cannot use recvfile in SOCK_DGRAM mode. |
The recvfile method reads certain amount of data and write it into a local file. It is always in blocking mode and will not return until the exact amount of data is received, file handler is bad (e.g., no disk space), or the connection is broken. Neither UDT_RCVSYN nor UDT_RCVTIMEO affects this method. The actual size of data to expect must be known before calling recvfile, otherwise deadlock may occur due to insufficient incoming data.