⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendfile.htm

📁 udt.sdk.4.1.tar.gz更新包
💻 HTM
字号:
<!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> UDT Reference</title><link rel="stylesheet" href="udtdoc.css" type="text/css" /></head><body><div class="ref_head">&nbsp;UDT Reference: Functions</div><h4 class="func_name"><strong>sendfile</strong></h4><p>The <b>sendfile</b> method sends out part or the whole of a local file.</p><div class="code">int64_t sendfile(<br />&nbsp; UDTSOCKET <font color="#FFFFFF">u</font>,<br />&nbsp; ifstream& <font color="#FFFFFF">ifs</font>,<br />&nbsp; const int64_t <font color="#FFFFFF">offset</font>,<br />&nbsp; const int64_t <font color="#FFFFFF">size</font>,<br />&nbsp; const int <font color="#FFFFFF">block</font> = 7320000<br />);</div><h5>Parameters</h5><dl>  <dt><i>u</i></dt>  <dd>[in] Descriptor identifying a connected socket.</dd>  <dt><i>ifs</i></dt>  <dd>[in] C++ ifstream descriptor for the file to read data from.</dd>  <dt><i>offset</i></dt>  <dd>[in] The offset position from where the data is read from the file.</dd>  <dt><i>size</i></dt>  <dd>[in] The total size to be sent.</dd>  <dt><i>block</i></dt>  <dd>[in] Optional. The size of every data block for file IO.</dd></dl><h5>Return Value</h5><p>On success, <b>sendfile</b> returns the actual size of data that has been sent. Otherwise UDT::ERROR is returned and specific error information can be retrieved by <a href="error.htm">getlasterror</a>.</p><table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">  <tr>    <td width="17%" class="table_headline"><strong>Error Name</strong></td>    <td width="17%" class="table_headline"><strong>Error Code</strong></td>    <td width="83%" class="table_headline"><strong>Comment</strong></td>  </tr>  <tr>    <td>ECONNLOST</td>    <td>2001</td>    <td>connection has been broken.</td>  </tr>  <tr>    <td>ENOCONN</td>    <td>2002</td>    <td><i>u</i> is not connected.</td>  </tr>  <tr>    <td>EINVOP</td>    <td>4000</td>    <td>File or disk system errors.</td>  </tr>  <tr>    <td>EINVSOCK</td>    <td>5004</td>    <td><i>u</i> is not an valid socket.</td>  </tr>  <tr>    <td>EDGRAMILL</td>    <td>5010</td>    <td>cannot use <i>sendfile</i> in SOCK_DGRAM mode.</td>  </tr></table><h5>Description</h5><p>The <strong>sendfile</strong> method sends certain amount of out of a local file. It is always in blocking mode and will not return until the exact amount of data is sent or the connection is broken. Neither UDT_SNDSYN nor UDT_SNDTIMEO affects this method.</p><p>Note that <strong>sendfile</strong> does NOT nessesarily require <strong>recvfile</strong> at the peer side. Send/recvfile and send/recv are orthogonal UDT methods.</p><h5>See Also</h5><p><strong><a href="send.htm">send</a>, <a href="recv.htm">recv</a>, <a href="recvfile.htm">recvfile</a></strong></p><p>&nbsp;</p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -