UDT Reference: CUDT Methods

recvfile

The recvfile method receives data into a file stream.

int recvfile(
   ofstream& ofs,

   const long long& offset,

   const long long& size
);

Parameters

ofs
[in] The output file stream into which the data will be written.
 
offset
[in] The position from where data will be put in.
size
[in] The total length of data to be received.

Return Values

Actual size of data received.

Exceptions

A CUDTException exception can be threw out if the UDT entity is not connected or the connection has been broken, or any file stream exception arises for ofs.

Description

The recvfile method receives data into a file stream no matter the data is sent by send, sendfile, or in a mixed way.

recvfile is always in blocking mode. The UDT_RCVSYN option only affects recv.

Zero or negative value is allowed for size. In such situation, the method returns immediately.

See Also

send, recv, sendfile