OLD | NEW |
| (Empty) |
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
2 <html xmlns="http://www.w3.org/1999/xhtml"> | |
3 <head> | |
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
5 <title> UDT Reference</title> | |
6 <link rel="stylesheet" href="udtdoc.css" type="text/css" /> | |
7 </head> | |
8 | |
9 <body> | |
10 <div class="ref_head"> UDT Reference: Functions</div> | |
11 | |
12 <h4 class="func_name"><strong>sendfile</strong></h4> | |
13 <p>The <b>sendfile</b> method sends out part or the whole of a local file.</p> | |
14 | |
15 <div class="code">int64_t sendfile(<br /> | |
16 UDTSOCKET <font color="#FFFFFF">u</font>,<br /> | |
17 fstream& <font color="#FFFFFF">ifs</font>,<br /> | |
18 const int64_t& <font color="#FFFFFF">offset</font>,<br /> | |
19 const int64_t <font color="#FFFFFF">size</font>,<br /> | |
20 const int <font color="#FFFFFF">block</font> = 7320000<br /> | |
21 );</div> | |
22 | |
23 <h5>Parameters</h5> | |
24 <dl> | |
25 <dt><i>u</i></dt> | |
26 <dd>[in] Descriptor identifying a connected socket.</dd> | |
27 <dt><i>ifs</i></dt> | |
28 <dd>[in] C++ fstream descriptor for the file to read data from.</dd> | |
29 <dt><i>offset</i></dt> | |
30 <dd>[in, out] The offset position from where the data is read from the file. A
fter the call returns, this value holds the updated read position. </dd> | |
31 <dt><i>size</i></dt> | |
32 <dd>[in] The total size to be sent.</dd> | |
33 <dt><i>block</i></dt> | |
34 <dd>[in] Optional. The size of every data block for file IO.</dd> | |
35 </dl> | |
36 | |
37 <h5>Return Value</h5> | |
38 <p>On success, <b>sendfile</b> returns the actual size of data that has been sen
t. Otherwise UDT::ERROR is returned and specific error information can be retrie
ved by | |
39 <a href="error.htm">getlasterror</a>.</p> | |
40 | |
41 <table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCC
CCC"> | |
42 <tr> | |
43 <td width="17%" class="table_headline"><strong>Error Name</strong></td> | |
44 <td width="17%" class="table_headline"><strong>Error Code</strong></td> | |
45 <td width="83%" class="table_headline"><strong>Comment</strong></td> | |
46 </tr> | |
47 <tr> | |
48 <td>ECONNLOST</td> | |
49 <td>2001</td> | |
50 <td>connection has been broken.</td> | |
51 </tr> | |
52 <tr> | |
53 <td>ENOCONN</td> | |
54 <td>2002</td> | |
55 <td><i>u</i> is not connected.</td> | |
56 </tr> | |
57 <tr> | |
58 <td>EINVOP</td> | |
59 <td>4000</td> | |
60 <td>File or disk system errors.</td> | |
61 </tr> | |
62 <tr> | |
63 <td>EINVSOCK</td> | |
64 <td>5004</td> | |
65 <td><i>u</i> is not an valid socket.</td> | |
66 </tr> | |
67 <tr> | |
68 <td>EDGRAMILL</td> | |
69 <td>5010</td> | |
70 <td>cannot use <i>sendfile</i> in SOCK_DGRAM mode.</td> | |
71 </tr> | |
72 <tr> | |
73 <td>EPEERERR</td> | |
74 <td>7000</td> | |
75 <td>The peer side has an unrecoverable error and this call has to be cancell
ed. </td> | |
76 </tr> | |
77 </table> | |
78 | |
79 <h5>Description</h5> | |
80 <p>The <strong>sendfile</strong> method sends certain amount of out of a local f
ile. It is always in blocking mode an neither UDT_SNDSYN nor UDT_SNDTIMEO affect
s this method. However, the <strong>sendfile</strong> method has a streaming sem
antics same as <a href="send.htm"><strong>send</strong></a>. </p> | |
81 <p>Note that <strong>sendfile</strong> does NOT nessesarily require <strong><a h
ref="recvfile.htm">recvfile</a></strong> at the peer side. Sendfile/recvfile and
send/recv are orthogonal | |
82 UDT methods.</p> | |
83 | |
84 <h5>See Also</h5> | |
85 <p><strong><a href="send.htm">send</a>, <a href="recv.htm">recv</a>, <a href="re
cvfile.htm">recvfile</a></strong></p> | |
86 <p> </p> | |
87 | |
88 </body> | |
89 </html> | |
OLD | NEW |