UDT Reference: UDT Functions |
The recvfile method sends out a file stream.
__int64 recvfile( UDTSOCKET u, const __int64& offset, const __int64& size, const int& block = 367000 |
u
[in] Handle to a connected socket.
ofs
[out] ofstream descriptor of the file to store the incoming data.
offset
[in] the position from where file is overwritten.
size
[in] the total size to be received.
block
[in] Optional. data block size for each receiving and writing.
On success, the actual size of data received is returned. Otherwise, UDT::ERROR is returned and the specific error information can be retrieved using getlasterror.
Error Code |
Comment |
2001 |
connection is broken before the IO completes. |
2002 |
u is not connected. |
5000 |
file system error. |
5004 |
u is an invalid UDT socket. |
5010 |
cannot use recvfile in SOCK_DGRAM mode. |
6004 |
a non-blocking overlapped recv is in progress. |
The recvfile method reads data directly into a file stream. It is always in blocking mode. The UDT_RCVSYN option only affects recv. In addition, UDT_SNDTIMEO does not apply to this method.