| Index: net/third_party/udt/doc/doc/t-file.htm
|
| ===================================================================
|
| --- net/third_party/udt/doc/doc/t-file.htm (revision 78992)
|
| +++ net/third_party/udt/doc/doc/t-file.htm (working copy)
|
| @@ -1,55 +0,0 @@
|
| -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| -<html xmlns="http://www.w3.org/1999/xhtml">
|
| -<head>
|
| -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
| -<title>Introduction</title>
|
| -<link rel="stylesheet" href="udtdoc.css" type="text/css" />
|
| -</head>
|
| -
|
| -<body>
|
| -<div class="ref_head"> UDT Tutorial</div>
|
| -
|
| -<h3><font color="#000080">File Transfer using UDT</font></h3>
|
| -<p>While you can always use regular UDT::send and UDT::recv to transfer a file, UDT provides a more convinient and optimized way for file transfer. An application can use UDT::sendfile
|
| -and UDT::recvfile directly. In addition, file transfer IO API and regular data IO API are orthogonal. E.g., the data stream sent out by UDT::sendfile does not necessarily require
|
| -UDT::recvfile to accept.</p>
|
| -
|
| -<p>The sendfile and recvfile methods are blocking call and are not affected by UDT_SNDSYN, UDT_RCVSYN, UDT_SBDTIMEO, or UDT_RCVTIMEO. They always complete the call with the specified
|
| -size parameter for sending or receiving unless errors occur.</p>
|
| -
|
| -<p>UDT uses C++ fstream for file IO.</p>
|
| -
|
| -<p><strong>Example</strong>: send a file using UDT.</p>
|
| -<div class="code">
|
| -UDTSOCKET fhandle;<br>
|
| -...<br>
|
| -<br>
|
| -ifstream& ifs("largefile.dat");<br>
|
| -ifs.seekg(0, ios::end);<br>
|
| -streampos size = ifs.tellg();<br>
|
| -ifs.seekg(0, ios::beg);<br>
|
| -<br>
|
| -if (UDT::ERROR == UDT::sendfile(fhandle, ifs, 0, size))<br>
|
| -{<br>
|
| - cout << "sendfile: " << UDT::getlasterror().getErrorMessage();<br>
|
| - return 0;<br>
|
| -}
|
| -</div>
|
| -
|
| -<p><strong>Example</strong>: Receive data into a file.</p>
|
| -<div class="code">
|
| -UDTSOCKET recver;<br>
|
| -...<br>
|
| -<br>
|
| -ofstream& ofs("largefile.dat");<br>
|
| -<br>
|
| -if (UDT::ERROR == UDT::recvfile(fhandle, ofs, 0, size))<br>
|
| -{<br>
|
| - cout << "recvfile: " << UDT::getlasterror().getErrorMessage();<br>
|
| - return 0;<br>
|
| -}
|
| -</div>
|
| -
|
| -<p> </p>
|
| -</body>
|
| -</html>
|
|
|