classconnection.html
来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 536 行 · 第 1/2 页
HTML
536 行
<td> </td> <td><p>This method determines whether the socket connection is connected. <dl compact><dt><b>Returns: </b><dd>bool indicating whether socket connection is available </dl><p>Definition at line <a class="el" href="Connection_8C-source.html#l00162">162</a> of file <a class="el" href="Connection_8C-source.html">Connection.C</a>.<p>References <a class="el" href="Connection_8h-source.html#l00066">m_sock</a>, and <a class="el" href="Connection_8h-source.html#l00053">_socket::socketfd</a>.<p>Referenced by <a class="el" href="Connection_8C-source.html#l00151">disconnect</a>(), and <a class="el" href="Connection_8C-source.html#l00276">show</a>(). </td> </tr></table><a name="a6" doxytag="Connection::message_loop"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int Connection::message_loop </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">FILE * </td> <td class="mdname" nowrap> <em>fpin</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>FILE * </td> <td class="mdname" nowrap> <em>fpout</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This method always loops and waits for input. When input is received from fpin then this input is send to the server using the current connection. When message is received from the server, this message is sent to fpout. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>fpin</em> </td><td>file pointer from which input is read (i.e. stdin ) </td></tr><tr><td valign=top><em>fpout</em> </td><td>file pointer to which output should be directed (i.e. stdout) </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>0 but only when error occured in reading input </dl><p>Definition at line <a class="el" href="Connection_8C-source.html#l00227">227</a> of file <a class="el" href="Connection_8C-source.html">Connection.C</a>.<p>References <a class="el" href="Connection_8h-source.html#l00067">m_iMaxMsgSize</a>, <a class="el" href="Connection_8h-source.html#l00066">m_sock</a>, <a class="el" href="Connection_8C-source.html#l00172">receiveMessage</a>(), <a class="el" href="Connection_8C-source.html#l00210">sendMessage</a>(), and <a class="el" href="Connection_8h-source.html#l00053">_socket::socketfd</a>. </td> </tr></table><a name="a7" doxytag="Connection::receiveMessage"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int Connection::receiveMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname" nowrap> <em>msg</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>maxsize</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This method reads a message from the connection. When there is no message available, it blocks till it receives a message. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>msg</em> </td><td>string in which message is stored </td></tr><tr><td valign=top><em>maxsize</em> </td><td>maximum size of the message. </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>-1: error, 0: 0 bytes were read, 1 when read was succesfull </dl><p>Definition at line <a class="el" href="Connection_8C-source.html#l00172">172</a> of file <a class="el" href="Connection_8C-source.html">Connection.C</a>.<p>References <a class="el" href="Connection_8h-source.html#l00066">m_sock</a>, <a class="el" href="Connection_8h-source.html#l00054">_socket::serv_addr</a>, and <a class="el" href="Connection_8h-source.html#l00053">_socket::socketfd</a>.<p>Referenced by <a class="el" href="SenseHandler_8C-source.html#l00101">SenseHandler::handleMessagesFromServer</a>(), and <a class="el" href="Connection_8C-source.html#l00227">message_loop</a>(). </td> </tr></table><a name="a8" doxytag="Connection::sendMessage"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool Connection::sendMessage </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const char * </td> <td class="mdname1" valign="top" nowrap> <em>msg</em> </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>This method sends a message to the server using the current connection. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>msg</em> </td><td>string which contains message </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>true on succes, false in case of failure </dl><p>Definition at line <a class="el" href="Connection_8C-source.html#l00210">210</a> of file <a class="el" href="Connection_8C-source.html">Connection.C</a>.<p>References <a class="el" href="Connection_8h-source.html#l00066">m_sock</a>, <a class="el" href="Connection_8h-source.html#l00054">_socket::serv_addr</a>, and <a class="el" href="Connection_8h-source.html#l00053">_socket::socketfd</a>.<p>Referenced by <a class="el" href="Connection_8C-source.html#l00227">message_loop</a>(), <a class="el" href="ActHandler_8C-source.html#l00102">ActHandler::sendCommands</a>(), <a class="el" href="ActHandler_8C-source.html#l00216">ActHandler::sendMessage</a>(), and <a class="el" href="ActHandler_8C-source.html#l00243">ActHandler::sendMessageDirect</a>(). </td> </tr></table><a name="a9" doxytag="Connection::show"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void Connection::show </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">ostream </td> <td class="mdname1" valign="top" nowrap> <em>os</em> </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>This method prints whether the connection is up or not. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>os</em> </td><td>output stream to which output should be directed </td></tr></table></dl><p>Definition at line <a class="el" href="Connection_8C-source.html#l00276">276</a> of file <a class="el" href="Connection_8C-source.html">Connection.C</a>.<p>References <a class="el" href="Connection_8C-source.html#l00162">isConnected</a>(). </td> </tr></table><hr><h2>Member Data Documentation</h2><a name="o1" doxytag="Connection::m_iMaxMsgSize"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int Connection::m_iMaxMsgSize<code> [private]</code> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>maximum message size for send and receive <p>Definition at line <a class="el" href="Connection_8h-source.html#l00067">67</a> of file <a class="el" href="Connection_8h-source.html">Connection.h</a>.<p>Referenced by <a class="el" href="Connection_8C-source.html#l00063">Connection</a>(), and <a class="el" href="Connection_8C-source.html#l00227">message_loop</a>(). </td> </tr></table><a name="o0" doxytag="Connection::m_sock"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="Connection_8h.html#a0">Socket</a> Connection::m_sock<code> [private]</code> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>communication protocol with the server. <p>Definition at line <a class="el" href="Connection_8h-source.html#l00066">66</a> of file <a class="el" href="Connection_8h-source.html">Connection.h</a>.<p>Referenced by <a class="el" href="Connection_8C-source.html#l00093">connect</a>(), <a class="el" href="Connection_8C-source.html#l00151">disconnect</a>(), <a class="el" href="Connection_8C-source.html#l00162">isConnected</a>(), <a class="el" href="Connection_8C-source.html#l00227">message_loop</a>(), <a class="el" href="Connection_8C-source.html#l00172">receiveMessage</a>(), and <a class="el" href="Connection_8C-source.html#l00210">sendMessage</a>(). </td> </tr></table><hr>The documentation for this class was generated from the following files:<ul><li><a class="el" href="Connection_8h-source.html">Connection.h</a><li><a class="el" href="Connection_8C-source.html">Connection.C</a></ul><hr><address><small>Generated on Thu Mar 7 00:37:53 2002 for UvA Trilearn 2001 by<a href="http://www.doxygen.org/index.html"><img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.12 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?