📄 recvfile.htm
字号:
<html><head><meta http-equiv="Content-Language" content="en-us"><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>UDT Reference</title></head><body><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1" bgcolor="#99CCFF" bordercolor="#99CCFF"> <tr> <td width="100%"><font face="Verdana" size="2"><i> UDT Reference: UDT Functions</i></font></td> </tr></table><h1 style='margin-bottom:0in;margin-bottom:.0001pt'><font face="Verdana" size="4">recvfile</font></h1><p><span style='font-size:10.0pt;font-family:Verdana'>The <b>recvfile </b>methodsends out a file stream.</span></p><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table2" bgcolor="#C0C0C0" bordercolor="#C0C0C0"> <tr> <td width="100%"> <p style='margin:0in;margin-bottom:.0001pt'><font face="Courier New" size="1">__int64 recvfile(</font></p> <p style='margin:0in;margin-bottom:.0001pt'><font face="Courier New" size="1"> UDTSOCKET u,<br> ofstream& <span style='color:white'>ofs</span>,</font></p> <p style='margin:0in;margin-bottom:.0001pt'><font face="Courier New" size="1"> const __int64& <span style='color:white'>offset</span>,</font></p> <p style='margin:0in;margin-bottom:.0001pt'><font face="Courier New" size="1"> const __int64& <span style='color:white'>size,</span></font></p> <p style='margin:0in;margin-bottom:.0001pt'><font face="Courier New" size="1"> const int& <span style='color:white'>block</span> = 367000<br> );</font></p> </td> </tr></table><h4><font face="Verdana" size="2">Parameters</font></h4><p style="margin-top: 0; margin-bottom: 0"><i><font face="Verdana" size="2">u</font></i></p><p style='margin-left:.5in; margin-top:0; margin-bottom:0'><font face="Verdana" size="2">[in] Handle to a connected socket.</font></p><p style="margin-top: 0; margin-bottom: 0"><i><font face="Verdana" size="2">ofs</font></i></p><p style='margin-left:.5in; margin-top:0; margin-bottom:0'><font face="Verdana" size="2">[out] ofstream descriptor of the file to store theincoming data.</font></p><p style="margin-top: 0; margin-bottom: 0"><i><font face="Verdana" size="2">offset</font></i></p><p style='margin-left:.5in; margin-top:0; margin-bottom:0'><font face="Verdana" size="2">[in] the position from where file is overwritten.</font></p><p style="margin-top: 0; margin-bottom: 0"><i><font face="Verdana" size="2">size</font></i></p><p style='margin-left:.5in; margin-top:0; margin-bottom:0'><font face="Verdana" size="2">[in] the total size to be received.</font></p><p style="margin-top: 0; margin-bottom: 0"><i><font face="Verdana" size="2">block</font></i></p><p style='margin-left:.5in; margin-top:0; margin-bottom:0'><font face="Verdana" size="2">[in] Optional. data block size for each receiving andwriting.</font></p><h4><font face="Verdana" size="2">Return Values</font></h4><p><font face="Verdana" size="2">On success, the actualsize of data received is returned. Otherwise, UDT::ERROR is returned and thespecific error information can be retrieved using <a href="error.htm">getlasterror</a>.</font></p><table border=1 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%; border-collapse:collapse;' id=table3 bordercolordark="#C0C0C0" bordercolorlight="#C0C0C0"> <tr> <td width=133 style='width:99.75pt;background:silver;padding:0in 0in 0in 0in'> <p align=center style='text-align:center'><b><font face="Verdana" size="2">Error Code</font></b></p> </td> <td width=812 style='width:609.0pt;background:silver;padding:0in 0in 0in 0in'> <p align=center style='text-align:center'><b><font face="Verdana" size="2">Comment</font></b></p> </td> </tr> <tr> <td width=133 style='width:99.75pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">2001</font></p> </td> <td width=812 style='width:609.0pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">connection is broken before the IO completes.</font></p> </td> </tr> <tr> <td width=133 style='width:99.75pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">2002</font></p> </td> <td width=812 style='width:609.0pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2"><i>u</i> is not connected.</font></p> </td> </tr> <tr> <td width=133 style='width:99.75pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">5000</font></p> </td> <td width=812 style='width:609.0pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">file system error.</font></p> </td> </tr> <tr> <td width=133 style='width:99.75pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">5004</font></p> </td> <td width=812 style='width:609.0pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2"><i>u</i> is an invalid UDT socket.</font></p> </td> </tr> <tr> <td width="133"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="2"> 5010</font></td> <td width="812"> <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="2"> cannot use <i>recvfile</i> in SOCK_DGRAM mode.</font></td> </tr> <tr> <td width=133 style='width:99.75pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">6004</font></p> </td> <td width=812 style='width:609.0pt;padding:0in 0in 0in 0in'> <p style='margin-top:1;margin-bottom:1'><font face="Verdana" size="2">a non-blocking overlapped recv is in progress.</font></p> </td> </tr></table><h4><font face="Verdana" size="2">Description</font></h4><p><font face="Verdana" size="2">The <b>recvfile </b>methodreads data directly into a file stream. It is always in blocking mode. The <ahref="opt.htm">UDT_RCVSYN</a> option only affects <a href="send.htm">recv</a>. Inaddition, <a href="opt.htm">UDT_SNDTIMEO</a> does not apply to this method.</font></p><h4><font face="Verdana" size="2">See Also</font></h4><p><b><font face="Verdana" size="2"><a href="send.htm">send</a>,<a href="sendfile.htm">sendfile</a>, <a href="recv.htm">recv</a></font></b></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -