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

📄 sendmsg.htm

📁 udt的一个源代码
💻 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>&nbsp;UDT Reference: UDT Functions</i></font></td>  </tr></table><h1><font face="Verdana" size="4">sendmsg</font></h1><p><font face="Verdana" size="2">The <b>sendmsg</b> method sends out an application message.</font></p><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber2" bgcolor="#C0C0C0" bordercolor="#C0C0C0">  <tr>    <td width="100%">    <p style="margin-top: 0; margin-bottom: 0">    <font size="1" face="Courier New">int sendmsg(<br>&nbsp; UDTSOCKET <font color="#FFFFFF">u</font>,</font></p>    <p style="margin-top: 0; margin-bottom: 0">    <font size="1" face="Courier New">&nbsp; const char *<font color="#FFFFFF"><a class="synParam" onclick="showTip(this)">buf</a></font>,	<br>&nbsp; int <font color="#FFFFFF"> <a class="synParam" onclick="showTip(this)">len</a></font>,	<br>    &nbsp; int <font color="#FFFFFF">ttl </font>= -1,</font></p>	<p style="margin-top: 0; margin-bottom: 0">    <font face="Courier New" size="1">&nbsp; bool <font color="#FFFFFF">inorder</font>&nbsp;=    false</font></p>	<p style="margin-top: 0; margin-bottom: 0">    <font face="Courier New" size="1">);</font></p>    </td>  </tr></table><h4><font face="Verdana" size="2">Parameters</font></h4><dl>	<dt><font face="Verdana"><i><font size="2">u</font></i><font size="2">	</font></font> </dt>	<dd><font face="Verdana" size="2">[in] Descriptor identifying a connected 	socket. </font></dd>	<dt><font face="Verdana"><i><font size="2">buf</font></i><font size="2">	</font></font> </dt>	<dd><font face="Verdana" size="2">[in] Buffer containing the message to be 	transmitted. </font></dd>	<dt><font face="Verdana"><i><font size="2">len</font></i><font size="2">	</font></font> </dt>	<dd><font face="Verdana" size="2">[in] Length of the data in <i>buf</i>. </font>	</dd>	<dt><font size="2" face="Verdana"><i>ttl</i></font> </dt>	<dd><font face="Verdana" size="2">[in] optional. Time-to-live of this      message.	</font></dd>	<dt><font size="2" face="Verdana"><i>inorder</i></font> </dt>	<dd><font face="Verdana" size="2">[in] optional. If the message should be      delivered in order. </font></dd></dl><h4><font face="Verdana" size="2">Return Values</font></h4><p><font face="Verdana" size="2">On success, the actual size of data sent is returned; Otherwise,UDT::ERROR is returned and the specific error information can be retrieved by<a href="error.htm">getlasterror</a>. The UDT_SNDTIMEO will be overwritten bythe <i>ttl</i> value, i.e., UDT_SNDTIMEO has no effects to sendmsg.</font></p>  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="table1" bordercolordark="#C0C0C0" bordercolorlight="#C0C0C0" width="100%">    <tr>      <th align="center" bgcolor="#C0C0C0" width="133">		<font face="Verdana" size="2">Error Code</font></th>      <th align="center" bgcolor="#C0C0C0" width="812"><b>      <font face="Verdana" size="2">Comment</font></b></th>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		2001</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		connection broken before send is completed.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		2002</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		<i>u 		</i>is not connected.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		5003</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		invalid parameters.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		5004</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		<i>u</i> 		is an invalid UDT socket.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		5009</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		cannot use <i>sendmsg</i> in SOCK_STREAM mode.</font></td>    </tr>    <tr>      <td width="133">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		6001</font></td>      <td width="812">      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">		insufficient buffer size for non-blocking sending.</font></td>    </tr>    </table>    <H4><font face="Verdana" size="2">Description</font></H4><P><font face="Verdana" size="2">The <b>sendmsg</b> method sends an applicationmessage as a whole. The application can specify a time-to-live value for eachindividual message. The message will only be dilevered within the TTL; otherwisethe message will be discarded. An negative value is equivalent to an infiniteTTL.</font></P><P><font face="Verdana" size="2">Applications can also specify if the messageshould be delivered in order, which means that the message cannot be retrievedby the receiver before all messages prior to it are either successfully receivedor discarded.</font></P><P><font face="Verdana" size="2">In blocking mode, the <b>sendmsg</b> is blocked until there is enough buffer size in the UDT sender's buffer. On non-blocking mode, <b>sendmsg</b> will return immediately. Note that messagewill always be sent as a whole; no partial message will be sent if there is notenough buffer spaces.</font></P><H4><font face="Verdana" size="2">See Also</font></H4><P><b><font face="Verdana" size="2"><a href="select.htm">select</a>, <a href="send.htm">send</a>, <a href="recv.htm">recv</a>, <a href="recvmsg.htm">recvmsg</a>,<a href="sendfile.htm">sendfile</a>, <a href="recvfile.htm">recvfile</a>, <a href="overlap.htm">getoverlappedresult</a></font></b></P></body></html>

⌨️ 快捷键说明

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