📄 a00158.html
字号:
<table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define PSOCK_READBUF </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="a00082.html">psock</a> </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Read data until the buffer is full. <p>This macro will block waiting for data and read the data into the input buffer specified with the call to <a class="el" href="a00158.html#g26ae707402e494f3895a9f012a93ea29">PSOCK_INIT()</a>. Data is read until the buffer is full..<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>psock</em> </td><td>(struct psock *) A pointer to the protosocket from which data should be read. </td></tr> </table></dl><p>Definition at line <a class="el" href="a00193.html#l00250">250</a> of file <a class="el" href="a00193.html">psock.h</a>. </td> </tr></table><a class="anchor" name="gb5d9c0becf7cb32d0aaef466839dd92e"></a><!-- doxytag: member="psock.h::PSOCK_READTO" ref="gb5d9c0becf7cb32d0aaef466839dd92e" args="(psock, c)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define PSOCK_READTO </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="a00082.html">psock</a>, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>c </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Read data up to a specified character. <p>This macro will block waiting for data and read the data into the input buffer specified with the call to <a class="el" href="a00158.html#g26ae707402e494f3895a9f012a93ea29">PSOCK_INIT()</a>. Data is only read until the specifieed character appears in the data stream.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>psock</em> </td><td>(struct psock *) A pointer to the protosocket from which data should be read.</td></tr> <tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>(char) The character at which to stop reading. </td></tr> </table></dl><dl compact><dt><b>Examples: </b></dt><dd><a class="el" href="a00036.html#a113">hello-world.c</a>, and <a class="el" href="a00038.html#a167">smtp.c</a>.</dl><p>Definition at line <a class="el" href="a00193.html#l00268">268</a> of file <a class="el" href="a00193.html">psock.h</a>. </td> </tr></table><a class="anchor" name="g70d236d1cf34b4e21836edda60247b70"></a><!-- doxytag: member="psock.h::PSOCK_SEND" ref="g70d236d1cf34b4e21836edda60247b70" args="(psock, data, datalen)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define PSOCK_SEND </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="a00082.html">psock</a>, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>data, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>datalen </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Send data. <p>This macro sends data over a protosocket. The protosocket protothread blocks until all data has been sent and is known to have been received by the remote end of the TCP connection.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>psock</em> </td><td>(struct psock *) A pointer to the protosocket over which data is to be sent.</td></tr> <tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>(char *) A pointer to the data that is to be sent.</td></tr> <tr><td valign="top"></td><td valign="top"><em>datalen</em> </td><td>(unsigned int) The length of the data that is to be sent. </td></tr> </table></dl><dl compact><dt><b>Examples: </b></dt><dd><a class="el" href="a00038.html#a178">smtp.c</a>.</dl><p>Definition at line <a class="el" href="a00193.html#l00178">178</a> of file <a class="el" href="a00193.html">psock.h</a>. </td> </tr></table><a class="anchor" name="gb0ad55aa96dd1d200cd0fc5a99f6a4f7"></a><!-- doxytag: member="psock.h::PSOCK_SEND_STR" ref="gb0ad55aa96dd1d200cd0fc5a99f6a4f7" args="(psock, str)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define PSOCK_SEND_STR </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="a00082.html">psock</a>, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>str </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Send a null-terminated string. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>psock</em> </td><td>Pointer to the protosocket. </td></tr> <tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>The string to be sent.</td></tr> </table></dl>This function sends a null-terminated string over the protosocket. <dl compact><dt><b>Examples: </b></dt><dd><a class="el" href="a00036.html#a112">hello-world.c</a>, and <a class="el" href="a00038.html#a172">smtp.c</a>.</dl><p>Definition at line <a class="el" href="a00193.html#l00191">191</a> of file <a class="el" href="a00193.html">psock.h</a>. </td> </tr></table><a class="anchor" name="g2ebfe5c8a7f3173714efdf2df74fc392"></a><!-- doxytag: member="psock.h::PSOCK_WAIT_UNTIL" ref="g2ebfe5c8a7f3173714efdf2df74fc392" args="(psock, condition)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define PSOCK_WAIT_UNTIL </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="a00082.html">psock</a>, <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>condition </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Wait until a condition is true. <p>This macro blocks the protothread until the specified condition is true. The macro <a class="el" href="a00158.html#g55ce98ea4d6f22e9d5068b904d4d2447">PSOCK_NEWDATA()</a> can be used to check if new data arrives when the protosocket is waiting.<p>Typically, this macro is used as follows:<p><div class="fragment"><pre class="fragment"> <a class="code" href="a00142.html#g3d4c8bd4aada659eb34f5d2ffd3e7901">PT_THREAD</a>(thread(<span class="keyword">struct</span> <a class="code" href="a00082.html">psock</a> *s, <span class="keyword">struct</span> <a class="code" href="a00087.html">timer</a> *t)) { <a class="code" href="a00158.html#g84901a5aa60040e96d272a69977edd22">PSOCK_BEGIN</a>(s); <a class="code" href="a00158.html#g2ebfe5c8a7f3173714efdf2df74fc392">PSOCK_WAIT_UNTIL</a>(s, PSOCK_NEWADATA(s) || <a class="code" href="a00156.html#g6d71dececfce707c668e6257aad5906e">timer_expired</a>(t)); <span class="keywordflow">if</span>(<a class="code" href="a00158.html#g55ce98ea4d6f22e9d5068b904d4d2447">PSOCK_NEWDATA</a>(s)) { <a class="code" href="a00158.html#gb5d9c0becf7cb32d0aaef466839dd92e">PSOCK_READTO</a>(s, <span class="charliteral">'\n'</span>); } <span class="keywordflow">else</span> { handle_timed_out(s); } <a class="code" href="a00158.html#g4a264bb64ae706d53f572b1d9e4037a2">PSOCK_END</a>(s); }</pre></div><p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>psock</em> </td><td>(struct psock *) A pointer to the protosocket. </td></tr> <tr><td valign="top"></td><td valign="top"><em>condition</em> </td><td>The condition to wait for. </td></tr> </table></dl><p>Definition at line <a class="el" href="a00193.html#l00372">372</a> of file <a class="el" href="a00193.html">psock.h</a>. </td> </tr></table><hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -