📄 class_c_chat_inet.html
字号:
<td> </td> <td><p>DisconnectL Disconnect from remote machine <p>Definition at line <a class="el" href="_chat_inet_8cpp-source.html#l00287">287</a> of file <a class="el" href="_chat_inet_8cpp-source.html">ChatInet.cpp</a>.<p>References <a class="el" href="_chat_inet_8cpp-source.html#l00308">DisconnectFromServerL()</a>, <a class="el" href="_chat_inet_8h-source.html#l00152">iLog</a>, <a class="el" href="class_m_log.html#70fb5098d98a8b349c056b46102d5de9">MLog::LogL()</a>, <a class="el" href="_chat_base_8cpp-source.html#l00130">CChatBase::SetState()</a>, and <a class="el" href="_chat_base_8cpp-source.html#l00140">CChatBase::State()</a>.<p>Referenced by <a class="el" href="_chat_appui_8cpp-source.html#l00201">CChatAppUi::HandleCommandL()</a>.<div class="fragment"><pre class="fragment"><a name="l00288"></a>00288 {<a name="l00289"></a>00289 <span class="keywordflow">if</span> ( ( <a class="code" href="class_c_chat_base.html#af77e92297a4bac4704e440284577ebe">State</a>() == EConnected )||( <a class="code" href="class_c_chat_base.html#af77e92297a4bac4704e440284577ebe">State</a>() == ESendingMessage ) )<a name="l00290"></a>00290 {<a name="l00291"></a>00291 <a class="code" href="class_c_chat_inet.html#e109483d24ec2fbd018840d64f6242c5">DisconnectFromServerL</a>();<a name="l00292"></a>00292 <a class="code" href="class_c_chat_base.html#deacd9f98d0548748cf116698aea2be0">SetState</a>( EDisconnecting );<a name="l00293"></a>00293 }<a name="l00294"></a>00294 <span class="keywordflow">else</span><a name="l00295"></a>00295 {<a name="l00296"></a>00296 HBufC* errNoConn = StringLoader::LoadLC ( R_CHAT_ERR_NO_CONN );<a name="l00297"></a>00297 <a class="code" href="class_c_chat_inet.html#9d387bbae93f2ae894f3e1c32e6bf1c6">iLog</a>.<a class="code" href="class_m_log.html#70fb5098d98a8b349c056b46102d5de9">LogL</a>( *errNoConn );<a name="l00298"></a>00298 CleanupStack::PopAndDestroy( errNoConn );<a name="l00299"></a>00299 User::Leave( KErrDisconnected );<a name="l00300"></a>00300 }<a name="l00301"></a>00301 }</pre></div><p> </td> </tr></table><a class="anchor" name="2ba04add62f4a2053e7628aea8d821af"></a><!-- doxytag: member="CChatInet::SendMessageL" ref="2ba04add62f4a2053e7628aea8d821af" args="(const TDesC &aText)" --><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">void CChatInet::SendMessageL </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const TDesC & </td> <td class="mdname1" valign="top" nowrap> <em>aText</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>SendMessageL Sends a message to a service on a remote machine. <p>Definition at line <a class="el" href="_chat_inet_8cpp-source.html#l00427">427</a> of file <a class="el" href="_chat_inet_8cpp-source.html">ChatInet.cpp</a>.<p>References <a class="el" href="_chat_inet_8h-source.html#l00230">iActiveSocket</a>, <a class="el" href="_chat_inet_8h-source.html#l00158">iMessage</a>, <a class="el" href="_chat_base_8cpp-source.html#l00130">CChatBase::SetState()</a>, and <a class="el" href="_chat_base_8cpp-source.html#l00140">CChatBase::State()</a>.<div class="fragment"><pre class="fragment"><a name="l00428"></a>00428 {<a name="l00429"></a>00429 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_base.html#af77e92297a4bac4704e440284577ebe">State</a>() != EConnected )<a name="l00430"></a>00430 {<a name="l00431"></a>00431 User::Leave( KErrDisconnected );<a name="l00432"></a>00432 }<a name="l00433"></a>00433 <a name="l00434"></a>00434 <span class="comment">// stop reading socket</span><a name="l00435"></a>00435 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a> )<a name="l00436"></a>00436 {<a name="l00437"></a>00437 <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a>->CancelRead(); <a name="l00438"></a>00438 }<a name="l00439"></a>00439 <a name="l00440"></a>00440 <span class="keywordflow">if</span> ( IsActive() )<a name="l00441"></a>00441 {<a name="l00442"></a>00442 Cancel();<a name="l00443"></a>00443 }<a name="l00444"></a>00444 <a name="l00445"></a>00445 TBufC<KChatTextBufLength> message ( aText );<a name="l00446"></a>00446 <a class="code" href="class_c_chat_base.html#deacd9f98d0548748cf116698aea2be0">SetState</a>( ESendingMessage );<a name="l00447"></a>00447 HBufC* tempString = HBufC::NewL( message.Length() );<a name="l00448"></a>00448 tempString->Des().Copy( message );<a name="l00449"></a>00449 <a name="l00450"></a>00450 <a class="code" href="class_c_chat_inet.html#83107f9dbd3370ed4e809e8cc7b35380">iMessage</a> = HBufC8::NewL(tempString->Length());<a name="l00451"></a>00451 <a class="code" href="class_c_chat_inet.html#83107f9dbd3370ed4e809e8cc7b35380">iMessage</a>->Des().Copy( *tempString );<a name="l00452"></a>00452 <a name="l00453"></a>00453 <span class="comment">// write message to socket</span><a name="l00454"></a>00454 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a> )<a name="l00455"></a>00455 {<a name="l00456"></a>00456 <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a>->Write( *<a class="code" href="class_c_chat_inet.html#83107f9dbd3370ed4e809e8cc7b35380">iMessage</a>, iStatus );<a name="l00457"></a>00457 }<a name="l00458"></a>00458 <span class="keyword">delete</span> tempString;<a name="l00459"></a>00459 SetActive();<a name="l00460"></a>00460 }</pre></div><p> </td> </tr></table><a class="anchor" name="78109ff8cb02d98ff75ab125fa94a8d4"></a><!-- doxytag: member="CChatInet::Stop" ref="78109ff8cb02d98ff75ab125fa94a8d4" args="()" --><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">void CChatInet::Stop </td> <td class="md" valign="top">( </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>Stop Stop server. <p>Definition at line <a class="el" href="_chat_inet_8cpp-source.html#l00528">528</a> of file <a class="el" href="_chat_inet_8cpp-source.html">ChatInet.cpp</a>.<p>References <a class="el" href="_chat_inet_8h-source.html#l00200">iAcceptedSocket</a>, <a class="el" href="_chat_inet_8h-source.html#l00230">iActiveSocket</a>, <a class="el" href="_chat_inet_8h-source.html#l00176">iSocket</a>, <a class="el" href="_chat_base_8cpp-source.html#l00130">CChatBase::SetState()</a>, and <a class="el" href="_chat_base_8cpp-source.html#l00140">CChatBase::State()</a>.<p>Referenced by <a class="el" href="_chat_appui_8cpp-source.html#l00201">CChatAppUi::HandleCommandL()</a>, and <a class="el" href="_chat_inet_8cpp-source.html#l00123">RunL()</a>.<div class="fragment"><pre class="fragment"><a name="l00529"></a>00529 {<a name="l00530"></a>00530 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_base.html#af77e92297a4bac4704e440284577ebe">State</a>() != EDisconnected )<a name="l00531"></a>00531 {<a name="l00532"></a>00532 <span class="comment">// Close() will wait forever for Read to complete</span><a name="l00533"></a>00533 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_base.html#af77e92297a4bac4704e440284577ebe">State</a>() == EConnected )<a name="l00534"></a>00534 {<a name="l00535"></a>00535 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a> )<a name="l00536"></a>00536 {<a name="l00537"></a>00537 iActiveSocket->CancelRead();<a name="l00538"></a>00538 }<a name="l00539"></a>00539 }<a name="l00540"></a>00540 <a class="code" href="class_c_chat_inet.html#43d47cb0a780f4af02110487231ac627">iAcceptedSocket</a>.Close();<a name="l00541"></a>00541 <a class="code" href="class_c_chat_inet.html#4791a9b2a2447d2068a89acb05c8c25b">iSocket</a>.Close();<a name="l00542"></a>00542 }<a name="l00543"></a>00543 <a class="code" href="class_c_chat_base.html#deacd9f98d0548748cf116698aea2be0">SetState</a>( EDisconnected );<a name="l00544"></a>00544 }</pre></div><p> </td> </tr></table><a class="anchor" name="06e3ea78e9321c78ffb364082161da6c"></a><!-- doxytag: member="CChatInet::RequestData" ref="06e3ea78e9321c78ffb364082161da6c" args="()" --><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">void CChatInet::RequestData </td> <td class="md" valign="top">( </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><a class="el" href="class_c_chat_inet.html#06e3ea78e9321c78ffb364082161da6c">RequestData()</a> Read more data from socket. <p>Definition at line <a class="el" href="_chat_inet_8cpp-source.html#l00551">551</a> of file <a class="el" href="_chat_inet_8cpp-source.html">ChatInet.cpp</a>.<p>References <a class="el" href="_chat_inet_8h-source.html#l00230">iActiveSocket</a>, <a class="el" href="_chat_inet_8h-source.html#l00182">iBuffer</a>, and <a class="el" href="_chat_inet_8h-source.html#l00206">iLen</a>.<p>Referenced by <a class="el" href="_chat_inet_8cpp-source.html#l00123">RunL()</a>.<div class="fragment"><pre class="fragment"><a name="l00552"></a>00552 {<a name="l00553"></a>00553 <span class="keywordflow">if</span> ( <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a> )<a name="l00554"></a>00554 {<a name="l00555"></a>00555 <a class="code" href="class_c_chat_inet.html#42435def2f80909f7700ad684c625f0f">iActiveSocket</a>->RecvOneOrMore( <a class="code" href="class_c_chat_inet.html#04fb56a9c5c1c56ed0335a50a6065a82">iBuffer</a>, 0, iStatus, <a class="code" href="class_c_chat_inet.html#cb196e8158421aa29d9c132a8522e9b4">iLen</a> );<a name="l00556"></a>00556 }<a name="l00557"></a>00557 SetActive();<a name="l00558"></a>00558 }</pre></div><p> </td> </tr></table><a class="anchor" name="4dc55dfb9b7a14b604eac53f42d0a222"></a><!-- doxytag: member="CChatInet::StartL" ref="4dc55dfb9b7a14b604eac53f42d0a222" args="()" --><p><table class="mdTable" cellpadding="2" cellspacing="0">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -