Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ea24284f03fd4a8a4b64047514d93f64 > files > 335

lib64kdegames1-devel-3.5.9-2mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">

<head>
  <title>libkdegames: kmessageio.cpp Source File (libkdegames)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta http-equiv="Content-Style-Type" content="text/css" />

  <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org"  r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org"  r (n 0 s 0 v 0 l 0))' />

  <meta name="trademark" content="KDE e.V." />
  <meta name="description" content="K Desktop Environment Homepage, KDE.org" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta name="robots" content="all" />

  <link rel="shortcut icon" href="../../favicon.ico" />

<link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" />



</head>

<body>

<div id="nav_header_top" align="right">
  <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a>

  <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a>
  <span class="doNotDisplay">::</span>

  <div id="nav_header_title" align="left">KDE API Reference</div>


</div>

<div id="nav_header_bottom" align="right">
  <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span>
  <div id="nav_header_bottom_right" style="text-align: left;">
/ <a href="../..">API Reference</a>
 / <a href=".">libkdegames</a>
  </div>
</div>


<table id="main" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
      <td valign="top" class="menuheader" height="0"></td>

  <td id="contentcolumn" valign="top" rowspan="2" >
    <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;">
    <a name="content"></a>


<!-- Generated by Doxygen 1.5.5 -->
<h1>kmessageio.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    This file is part of the KDE games library</span>
<a name="l00003"></a>00003 <span class="comment">    Copyright (C) 2001 Burkhard Lehner (Burkhard.Lehner@gmx.de)</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">    This library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">    modify it under the terms of the GNU Library General Public</span>
<a name="l00007"></a>00007 <span class="comment">    License version 2 as published by the Free Software Foundation.</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">    This library is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00012"></a>00012 <span class="comment">    Library General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">    You should have received a copy of the GNU Library General Public License</span>
<a name="l00015"></a>00015 <span class="comment">    along with this library; see the file COPYING.LIB.  If not, write to</span>
<a name="l00016"></a>00016 <span class="comment">    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span>
<a name="l00017"></a>00017 <span class="comment">    Boston, MA 02110-1301, USA.</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="comment">/*</span>
<a name="l00021"></a>00021 <span class="comment">     KMessageIO class and subclasses KMessageSocket and KMessageDirect</span>
<a name="l00022"></a>00022 <span class="comment">*/</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include "kmessageio.h"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;qsocket.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;kdebug.h&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;kprocess.h&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;qfile.h&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="comment">// ----------------------- KMessageIO -------------------------</span>
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="classKMessageIO.html#f441515cc8006af2190fd8220c260cb8">00032</a> <a class="code" href="classKMessageIO.html#f441515cc8006af2190fd8220c260cb8" title="The usual QObject constructor, does nothing else.">KMessageIO::KMessageIO</a> (QObject *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00033"></a>00033   : QObject (parent, name), m_id (0)
<a name="l00034"></a>00034 {}
<a name="l00035"></a>00035 
<a name="l00036"></a><a class="code" href="classKMessageIO.html#bc96e3cd30d933c9febabceee01b7e04">00036</a> <a class="code" href="classKMessageIO.html#bc96e3cd30d933c9febabceee01b7e04" title="The usual destructor, does nothing special.">KMessageIO::~KMessageIO</a> ()
<a name="l00037"></a>00037 {}
<a name="l00038"></a>00038 
<a name="l00039"></a><a class="code" href="classKMessageIO.html#fe28b6039098d66a8aea760990a39049">00039</a> <span class="keywordtype">void</span> <a class="code" href="classKMessageIO.html#fe28b6039098d66a8aea760990a39049" title="Sets the ID number of this object.">KMessageIO::setId</a> (Q_UINT32 <span class="keywordtype">id</span>)
<a name="l00040"></a>00040 {
<a name="l00041"></a>00041   m_id = id;
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043 
<a name="l00044"></a><a class="code" href="classKMessageIO.html#8ddc66bc4a2178ba1bcd447056c734a3">00044</a> Q_UINT32 <a class="code" href="classKMessageIO.html#8ddc66bc4a2178ba1bcd447056c734a3" title="Queries the ID of this object.">KMessageIO::id</a> ()
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046   <span class="keywordflow">return</span> m_id;
<a name="l00047"></a>00047 }
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 <span class="comment">// ----------------------KMessageSocket -----------------------</span>
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="classKMessageSocket.html#d8064d3e0d79fef411f82a2f04cbb6d4">00051</a> <a class="code" href="classKMessageSocket.html#d8064d3e0d79fef411f82a2f04cbb6d4" title="Connects to a server socket on /e host with /e port.">KMessageSocket::KMessageSocket</a> (QString host, Q_UINT16 port, QObject *parent, 
<a name="l00052"></a>00052 <span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00053"></a>00053   : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a> (parent, name)
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055   mSocket = <span class="keyword">new</span> QSocket ();
<a name="l00056"></a>00056   mSocket-&gt;connectToHost (host, port);
<a name="l00057"></a>00057   initSocket ();
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00060"></a><a class="code" href="classKMessageSocket.html#3861a29bd3e21756bf162b2e457f7184">00060</a> <a class="code" href="classKMessageSocket.html#d8064d3e0d79fef411f82a2f04cbb6d4" title="Connects to a server socket on /e host with /e port.">KMessageSocket::KMessageSocket</a> (QHostAddress host, Q_UINT16 port, QObject 
<a name="l00061"></a>00061 *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00062"></a>00062   : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a> (parent, name)
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064   mSocket = <span class="keyword">new</span> QSocket ();
<a name="l00065"></a>00065   mSocket-&gt;connectToHost (host.toString(), port);
<a name="l00066"></a>00066   initSocket ();
<a name="l00067"></a>00067 }
<a name="l00068"></a>00068 
<a name="l00069"></a><a class="code" href="classKMessageSocket.html#569c7d187cb5618b5c030499bf76cf1f">00069</a> <a class="code" href="classKMessageSocket.html#d8064d3e0d79fef411f82a2f04cbb6d4" title="Connects to a server socket on /e host with /e port.">KMessageSocket::KMessageSocket</a> (QSocket *socket, QObject *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> 
<a name="l00070"></a>00070 *name)
<a name="l00071"></a>00071   : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a> (parent, name)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073   mSocket = socket;
<a name="l00074"></a>00074   initSocket ();
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="classKMessageSocket.html#e1c91692a48e7cd8fbf7553fe75531cd">00077</a> <a class="code" href="classKMessageSocket.html#d8064d3e0d79fef411f82a2f04cbb6d4" title="Connects to a server socket on /e host with /e port.">KMessageSocket::KMessageSocket</a> (<span class="keywordtype">int</span> socketFD, QObject *parent, <span class="keyword">const</span> <span class="keywordtype">char</span> 
<a name="l00078"></a>00078 *name)
<a name="l00079"></a>00079   : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a> (parent, name)
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081   mSocket = <span class="keyword">new</span> QSocket ();
<a name="l00082"></a>00082   mSocket-&gt;setSocket (socketFD);
<a name="l00083"></a>00083   initSocket ();
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 
<a name="l00086"></a><a class="code" href="classKMessageSocket.html#9b17b632ca342a233206923d1bbd4464">00086</a> <a class="code" href="classKMessageSocket.html#9b17b632ca342a233206923d1bbd4464" title="Destructor, closes the socket.">KMessageSocket::~KMessageSocket</a> ()
<a name="l00087"></a>00087 {
<a name="l00088"></a>00088   <span class="keyword">delete</span> mSocket;
<a name="l00089"></a>00089 }
<a name="l00090"></a>00090 
<a name="l00091"></a><a class="code" href="classKMessageSocket.html#3bb9822c6a03b372a82a24610e70d84a">00091</a> <span class="keywordtype">bool</span> <a class="code" href="classKMessageSocket.html#3bb9822c6a03b372a82a24610e70d84a" title="Returns true if the socket is in state /e connected.">KMessageSocket::isConnected</a> ()<span class="keyword"> const</span>
<a name="l00092"></a>00092 <span class="keyword"></span>{
<a name="l00093"></a>00093   <span class="keywordflow">return</span> mSocket-&gt;state() == QSocket::Connection;
<a name="l00094"></a>00094 }
<a name="l00095"></a>00095 
<a name="l00096"></a><a class="code" href="classKMessageSocket.html#325a64653cd9a62b34fb10e4eb72a4ff">00096</a> <span class="keywordtype">void</span> <a class="code" href="classKMessageSocket.html#325a64653cd9a62b34fb10e4eb72a4ff" title="Overwritten slot method from KMessageIO.">KMessageSocket::send</a> (<span class="keyword">const</span> QByteArray &amp;msg)
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098   QDataStream str (mSocket);
<a name="l00099"></a>00099   str &lt;&lt; Q_UINT8 (<span class="charliteral">'M'</span>);  <span class="comment">// magic number for begin of message</span>
<a name="l00100"></a>00100   str.writeBytes (msg.data(), msg.size());  <span class="comment">// writes the length (as Q_UINT32) and the data</span>
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102 
<a name="l00103"></a>00103 <span class="keywordtype">void</span> KMessageSocket::processNewData ()
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105   <span class="keywordflow">if</span> (isRecursive)
<a name="l00106"></a>00106     <span class="keywordflow">return</span>;
<a name="l00107"></a>00107   isRecursive = <span class="keyword">true</span>;
<a name="l00108"></a>00108 
<a name="l00109"></a>00109   QDataStream str (mSocket);
<a name="l00110"></a>00110   <span class="keywordflow">while</span> (mSocket-&gt;bytesAvailable() &gt; 0)
<a name="l00111"></a>00111   {
<a name="l00112"></a>00112     <span class="keywordflow">if</span> (mAwaitingHeader)
<a name="l00113"></a>00113     {
<a name="l00114"></a>00114       <span class="comment">// Header = magic number + packet length = 5 bytes</span>
<a name="l00115"></a>00115       <span class="keywordflow">if</span> (mSocket-&gt;bytesAvailable() &lt; 5)
<a name="l00116"></a>00116       {
<a name="l00117"></a>00117         isRecursive = <span class="keyword">false</span>;
<a name="l00118"></a>00118         <span class="keywordflow">return</span>;
<a name="l00119"></a>00119       }
<a name="l00120"></a>00120 
<a name="l00121"></a>00121       <span class="comment">// Read the magic number first. If something unexpected is found,</span>
<a name="l00122"></a>00122       <span class="comment">// start over again, ignoring the data that was read up to then.</span>
<a name="l00123"></a>00123 
<a name="l00124"></a>00124       Q_UINT8 v;
<a name="l00125"></a>00125       str &gt;&gt; v;
<a name="l00126"></a>00126       <span class="keywordflow">if</span> (v != <span class="charliteral">'M'</span>)
<a name="l00127"></a>00127       {
<a name="l00128"></a>00128         kdWarning(11001) &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Received unexpected data, magic number wrong!"</span> &lt;&lt; endl;
<a name="l00129"></a>00129         <span class="keywordflow">continue</span>;
<a name="l00130"></a>00130       }
<a name="l00131"></a>00131 
<a name="l00132"></a>00132       str &gt;&gt; mNextBlockLength;
<a name="l00133"></a>00133       mAwaitingHeader = <span class="keyword">false</span>;
<a name="l00134"></a>00134     }
<a name="l00135"></a>00135     <span class="keywordflow">else</span>
<a name="l00136"></a>00136     {
<a name="l00137"></a>00137       <span class="comment">// Data not completely read =&gt; wait for more</span>
<a name="l00138"></a>00138       <span class="keywordflow">if</span> (mSocket-&gt;bytesAvailable() &lt; (Q_ULONG) mNextBlockLength)
<a name="l00139"></a>00139       {
<a name="l00140"></a>00140         isRecursive = <span class="keyword">false</span>;
<a name="l00141"></a>00141         <span class="keywordflow">return</span>;
<a name="l00142"></a>00142       }
<a name="l00143"></a>00143 
<a name="l00144"></a>00144       QByteArray msg (mNextBlockLength);
<a name="l00145"></a>00145       str.readRawBytes (msg.data(), mNextBlockLength);
<a name="l00146"></a>00146 
<a name="l00147"></a>00147       <span class="comment">// send the received message</span>
<a name="l00148"></a>00148       emit <a class="code" href="classKMessageIO.html#c2925ec4f163a91f15b037dcd9dc93a2" title="This signal is emitted when /e send() on the connected KMessageIO object is called...">received</a> (msg);
<a name="l00149"></a>00149 
<a name="l00150"></a>00150       <span class="comment">// Waiting for the header of the next message</span>
<a name="l00151"></a>00151       mAwaitingHeader = <span class="keyword">true</span>;
<a name="l00152"></a>00152     }
<a name="l00153"></a>00153   }
<a name="l00154"></a>00154 
<a name="l00155"></a>00155   isRecursive = <span class="keyword">false</span>;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 <span class="keywordtype">void</span> KMessageSocket::initSocket ()
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160   connect (mSocket, SIGNAL (error(<span class="keywordtype">int</span>)), SIGNAL (<a class="code" href="classKMessageIO.html#84d97fb77fbd43ea40baa2eec1f45ec5" title="This signal is emitted when the connection is closed.">connectionBroken</a>()));
<a name="l00161"></a>00161   connect (mSocket, SIGNAL (connectionClosed()), SIGNAL (<a class="code" href="classKMessageIO.html#84d97fb77fbd43ea40baa2eec1f45ec5" title="This signal is emitted when the connection is closed.">connectionBroken</a>()));
<a name="l00162"></a>00162   connect (mSocket, SIGNAL (readyRead()), SLOT (processNewData()));
<a name="l00163"></a>00163   mAwaitingHeader = <span class="keyword">true</span>;
<a name="l00164"></a>00164   mNextBlockLength = 0;
<a name="l00165"></a>00165   isRecursive = <span class="keyword">false</span>;
<a name="l00166"></a>00166 }
<a name="l00167"></a>00167 
<a name="l00168"></a><a class="code" href="classKMessageSocket.html#4973e0515fa5c8b5e89672c1a46dde2f">00168</a> Q_UINT16 <a class="code" href="classKMessageSocket.html#4973e0515fa5c8b5e89672c1a46dde2f">KMessageSocket::peerPort</a> ()<span class="keyword"> const</span>
<a name="l00169"></a>00169 <span class="keyword"></span>{
<a name="l00170"></a>00170   <span class="keywordflow">return</span> mSocket-&gt;peerPort();
<a name="l00171"></a>00171 }
<a name="l00172"></a>00172 
<a name="l00173"></a><a class="code" href="classKMessageSocket.html#37509479743000c80e9c8cf062e3a496">00173</a> QString <a class="code" href="classKMessageSocket.html#37509479743000c80e9c8cf062e3a496">KMessageSocket::peerName</a> ()<span class="keyword"> const</span>
<a name="l00174"></a>00174 <span class="keyword"></span>{
<a name="l00175"></a>00175   <span class="keywordflow">return</span> mSocket-&gt;peerName();
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 
<a name="l00178"></a>00178 <span class="comment">// ----------------------KMessageDirect -----------------------</span>
<a name="l00179"></a>00179 
<a name="l00180"></a><a class="code" href="classKMessageDirect.html#26b8990db45f3084e9267623f1aa25c7">00180</a> <a class="code" href="classKMessageDirect.html#26b8990db45f3084e9267623f1aa25c7" title="Creates an object and connects it to the object given in the first parameter.">KMessageDirect::KMessageDirect</a> (<a class="code" href="classKMessageDirect.html" title="This class implements the message communication using function calls directly.">KMessageDirect</a> *partner, QObject *parent, 
<a name="l00181"></a>00181 <span class="keyword">const</span> <span class="keywordtype">char</span> *name)
<a name="l00182"></a>00182   : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a> (parent, name), mPartner (0)
<a name="l00183"></a>00183 {
<a name="l00184"></a>00184   <span class="comment">// 0 as first parameter leaves the object unconnected</span>
<a name="l00185"></a>00185   <span class="keywordflow">if</span> (!partner)
<a name="l00186"></a>00186     <span class="keywordflow">return</span>;
<a name="l00187"></a>00187 
<a name="l00188"></a>00188   <span class="comment">// Check if the other object is already connected</span>
<a name="l00189"></a>00189   <span class="keywordflow">if</span> (partner &amp;&amp; partner-&gt;<a class="code" href="classKMessageDirect.html#3e567970116c0d990a2a6ee19b195a6f">mPartner</a>)
<a name="l00190"></a>00190   {
<a name="l00191"></a>00191     kdWarning(11001) &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Object is already connected!"</span> &lt;&lt; endl;
<a name="l00192"></a>00192     <span class="keywordflow">return</span>;
<a name="l00193"></a>00193   }
<a name="l00194"></a>00194 
<a name="l00195"></a>00195   <span class="comment">// Connect from us to that object</span>
<a name="l00196"></a>00196   mPartner = partner;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198   <span class="comment">// Connect the other object to us</span>
<a name="l00199"></a>00199   partner-&gt;<a class="code" href="classKMessageDirect.html#3e567970116c0d990a2a6ee19b195a6f">mPartner</a> = <span class="keyword">this</span>;
<a name="l00200"></a>00200 }
<a name="l00201"></a>00201 
<a name="l00202"></a><a class="code" href="classKMessageDirect.html#2a7d37f0e955dd40ef35dcb2e13cbff4">00202</a> <a class="code" href="classKMessageDirect.html#2a7d37f0e955dd40ef35dcb2e13cbff4" title="Destructor, closes the connection.">KMessageDirect::~KMessageDirect</a> ()
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204   <span class="keywordflow">if</span> (mPartner)
<a name="l00205"></a>00205   {
<a name="l00206"></a>00206     mPartner-&gt;<a class="code" href="classKMessageDirect.html#3e567970116c0d990a2a6ee19b195a6f">mPartner</a> = 0;
<a name="l00207"></a>00207     emit mPartner-&gt;<a class="code" href="classKMessageIO.html#84d97fb77fbd43ea40baa2eec1f45ec5" title="This signal is emitted when the connection is closed.">connectionBroken</a>();
<a name="l00208"></a>00208   }
<a name="l00209"></a>00209 }
<a name="l00210"></a>00210 
<a name="l00211"></a><a class="code" href="classKMessageDirect.html#e1a47b43f8cda3f8363491a795c6197b">00211</a> <span class="keywordtype">bool</span> <a class="code" href="classKMessageDirect.html#e1a47b43f8cda3f8363491a795c6197b" title="Returns true, if the object is connected to another instance.">KMessageDirect::isConnected</a> ()<span class="keyword"> const</span>
<a name="l00212"></a>00212 <span class="keyword"></span>{
<a name="l00213"></a>00213   <span class="keywordflow">return</span> mPartner != 0;
<a name="l00214"></a>00214 }
<a name="l00215"></a>00215 
<a name="l00216"></a><a class="code" href="classKMessageDirect.html#ac1022521f741c07ec93db28c5cdd09b">00216</a> <span class="keywordtype">void</span> <a class="code" href="classKMessageDirect.html#ac1022521f741c07ec93db28c5cdd09b" title="Overwritten slot method from KMessageIO.">KMessageDirect::send</a> (<span class="keyword">const</span> QByteArray &amp;msg)
<a name="l00217"></a>00217 {
<a name="l00218"></a>00218   <span class="keywordflow">if</span> (mPartner)
<a name="l00219"></a>00219     emit mPartner-&gt;<a class="code" href="classKMessageIO.html#c2925ec4f163a91f15b037dcd9dc93a2" title="This signal is emitted when /e send() on the connected KMessageIO object is called...">received</a> (msg);
<a name="l00220"></a>00220   <span class="keywordflow">else</span>
<a name="l00221"></a>00221     kdError(11001) &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Not yet connected!"</span> &lt;&lt; endl;
<a name="l00222"></a>00222 }
<a name="l00223"></a>00223 
<a name="l00224"></a>00224 
<a name="l00225"></a>00225 <span class="comment">// ----------------------- KMessageProcess ---------------------------</span>
<a name="l00226"></a>00226 
<a name="l00227"></a>00227 KMessageProcess::~KMessageProcess()
<a name="l00228"></a>00228 {
<a name="l00229"></a>00229   kdDebug(11001) &lt;&lt; <span class="stringliteral">"@@@KMessageProcess::Delete process"</span> &lt;&lt; endl;
<a name="l00230"></a>00230   <span class="keywordflow">if</span> (mProcess)
<a name="l00231"></a>00231   {
<a name="l00232"></a>00232     mProcess-&gt;kill();
<a name="l00233"></a>00233     <span class="keyword">delete</span> mProcess;
<a name="l00234"></a>00234     mProcess=0;
<a name="l00235"></a>00235     <span class="comment">// Remove not send buffers</span>
<a name="l00236"></a>00236     mQueue.setAutoDelete(<span class="keyword">true</span>);
<a name="l00237"></a>00237     mQueue.clear();
<a name="l00238"></a>00238     <span class="comment">// Maybe todo: delete mSendBuffer</span>
<a name="l00239"></a>00239   }
<a name="l00240"></a>00240 }
<a name="l00241"></a>00241 KMessageProcess::KMessageProcess(QObject *parent, QString file) : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a>(parent,0)
<a name="l00242"></a>00242 {
<a name="l00243"></a>00243   <span class="comment">// Start process</span>
<a name="l00244"></a>00244   kdDebug(11001) &lt;&lt; <span class="stringliteral">"@@@KMessageProcess::Start process"</span> &lt;&lt; endl;
<a name="l00245"></a>00245   mProcessName=file;
<a name="l00246"></a>00246   mProcess=<span class="keyword">new</span> KProcess;
<a name="l00247"></a>00247   <span class="keywordtype">int</span> <span class="keywordtype">id</span>=0;
<a name="l00248"></a>00248   *mProcess &lt;&lt; mProcessName &lt;&lt; QString(<span class="stringliteral">"%1"</span>).arg(<span class="keywordtype">id</span>);
<a name="l00249"></a>00249   kdDebug(11001) &lt;&lt; <span class="stringliteral">"@@@KMessageProcess::Init:Id= "</span> &lt;&lt; <span class="keywordtype">id</span> &lt;&lt; endl;
<a name="l00250"></a>00250   kdDebug(11001) &lt;&lt; <span class="stringliteral">"@@@KMessgeProcess::Init:Processname: "</span> &lt;&lt; mProcessName &lt;&lt; endl;
<a name="l00251"></a>00251   connect(mProcess, SIGNAL(receivedStdout(KProcess *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span> )),
<a name="l00252"></a>00252                         <span class="keyword">this</span>, SLOT(slotReceivedStdout(KProcess *, <span class="keywordtype">char</span> * , <span class="keywordtype">int</span> )));
<a name="l00253"></a>00253   connect(mProcess, SIGNAL(receivedStderr(KProcess *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span> )),
<a name="l00254"></a>00254                         <span class="keyword">this</span>, SLOT(slotReceivedStderr(KProcess *, <span class="keywordtype">char</span> * , <span class="keywordtype">int</span> )));
<a name="l00255"></a>00255   connect(mProcess, SIGNAL(processExited(KProcess *)),
<a name="l00256"></a>00256                         <span class="keyword">this</span>, SLOT(slotProcessExited(KProcess *)));
<a name="l00257"></a>00257   connect(mProcess, SIGNAL(wroteStdin(KProcess *)),
<a name="l00258"></a>00258                         <span class="keyword">this</span>, SLOT(slotWroteStdin(KProcess *)));
<a name="l00259"></a>00259   mProcess-&gt;start(KProcess::NotifyOnExit,KProcess::All);
<a name="l00260"></a>00260   mSendBuffer=0;
<a name="l00261"></a>00261   mReceiveCount=0;
<a name="l00262"></a>00262   mReceiveBuffer.resize(1024);
<a name="l00263"></a>00263 }
<a name="l00264"></a>00264 <span class="keywordtype">bool</span> KMessageProcess::isConnected()<span class="keyword"> const</span>
<a name="l00265"></a>00265 <span class="keyword"></span>{
<a name="l00266"></a>00266   kdDebug(11001) &lt;&lt; <span class="stringliteral">"@@@KMessageProcess::Is conencted"</span> &lt;&lt; endl;
<a name="l00267"></a>00267   <span class="keywordflow">if</span> (!mProcess) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00268"></a>00268   <span class="keywordflow">return</span> mProcess-&gt;isRunning();
<a name="l00269"></a>00269 }
<a name="l00270"></a>00270 <span class="keywordtype">void</span> KMessageProcess::send(<span class="keyword">const</span> QByteArray &amp;msg)
<a name="l00271"></a>00271 {
<a name="l00272"></a>00272   kdDebug(11001) &lt;&lt; <span class="stringliteral">"@@@KMessageProcess:: SEND("</span>&lt;&lt;msg.size()&lt;&lt;<span class="stringliteral">") to process"</span> &lt;&lt; endl;
<a name="l00273"></a>00273   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size=msg.size()+2*<span class="keyword">sizeof</span>(long);
<a name="l00274"></a>00274 
<a name="l00275"></a>00275   <span class="keywordtype">char</span> *tmpbuffer=<span class="keyword">new</span> <span class="keywordtype">char</span>[size];
<a name="l00276"></a>00276   <span class="keywordtype">long</span> *p1=(<span class="keywordtype">long</span> *)tmpbuffer;
<a name="l00277"></a>00277   <span class="keywordtype">long</span> *p2=p1+1;
<a name="l00278"></a>00278   kdDebug(11001)  &lt;&lt; <span class="stringliteral">"p1="</span>&lt;&lt;p1 &lt;&lt; <span class="stringliteral">"p2="</span>&lt;&lt; p2 &lt;&lt; endl;
<a name="l00279"></a>00279   memcpy(tmpbuffer+2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>),msg.data(),msg.size());
<a name="l00280"></a>00280   *p1=0x4242aeae;
<a name="l00281"></a>00281   *p2=size;
<a name="l00282"></a>00282   
<a name="l00283"></a>00283   QByteArray *buffer=<span class="keyword">new</span> QByteArray();
<a name="l00284"></a>00284   buffer-&gt;assign(tmpbuffer,size);
<a name="l00285"></a>00285   <span class="comment">// buffer-&gt;duplicate(msg);</span>
<a name="l00286"></a>00286   mQueue.enqueue(buffer);
<a name="l00287"></a>00287   writeToProcess(); 
<a name="l00288"></a>00288 }
<a name="l00289"></a>00289 <span class="keywordtype">void</span> KMessageProcess::writeToProcess()
<a name="l00290"></a>00290 {
<a name="l00291"></a>00291   <span class="comment">// Previous send ok and item in queue</span>
<a name="l00292"></a>00292   <span class="keywordflow">if</span> (mSendBuffer || mQueue.isEmpty()) <span class="keywordflow">return</span> ;
<a name="l00293"></a>00293   mSendBuffer=mQueue.dequeue();
<a name="l00294"></a>00294   <span class="keywordflow">if</span> (!mSendBuffer) return ;
<a name="l00295"></a>00295 
<a name="l00296"></a>00296   <span class="comment">// write it out to the process</span>
<a name="l00297"></a>00297   <span class="comment">//  kdDebug(11001) &lt;&lt; " @@@@@@ writeToProcess::SEND to process " &lt;&lt; mSendBuffer-&gt;size() &lt;&lt; " BYTE " &lt;&lt; endl;</span>
<a name="l00298"></a>00298   <span class="comment">//  char *p=mSendBuffer-&gt;data();</span>
<a name="l00299"></a>00299   <span class="comment">//  for (int i=0;i&lt;16;i++) printf("%02x ",(unsigned char)(*(p+i)));printf("\n");</span>
<a name="l00300"></a>00300   mProcess-&gt;writeStdin(mSendBuffer-&gt;data(),mSendBuffer-&gt;size());
<a name="l00301"></a>00301 
<a name="l00302"></a>00302 }
<a name="l00303"></a>00303 <span class="keywordtype">void</span> KMessageProcess::slotWroteStdin(KProcess * )
<a name="l00304"></a>00304 {
<a name="l00305"></a>00305   kdDebug(11001) &lt;&lt; k_funcinfo &lt;&lt; endl;
<a name="l00306"></a>00306   <span class="keywordflow">if</span> (mSendBuffer)
<a name="l00307"></a>00307   {
<a name="l00308"></a>00308     <span class="keyword">delete</span> mSendBuffer;
<a name="l00309"></a>00309     mSendBuffer=0;
<a name="l00310"></a>00310   }
<a name="l00311"></a>00311   writeToProcess();
<a name="l00312"></a>00312 }
<a name="l00313"></a>00313 
<a name="l00314"></a>00314 <span class="keywordtype">void</span> KMessageProcess::slotReceivedStderr(KProcess * proc, <span class="keywordtype">char</span> *buffer, <span class="keywordtype">int</span> buflen)
<a name="l00315"></a>00315 {
<a name="l00316"></a>00316   <span class="keywordtype">int</span> pid=0;
<a name="l00317"></a>00317   <span class="keywordtype">int</span> len;
<a name="l00318"></a>00318   <span class="keywordtype">char</span> *p;
<a name="l00319"></a>00319   <span class="keywordtype">char</span> *pos;
<a name="l00320"></a>00320 <span class="comment">//  kdDebug(11001)&lt;&lt;"############# Got stderr " &lt;&lt; buflen &lt;&lt; " bytes" &lt;&lt; endl;</span>
<a name="l00321"></a>00321 
<a name="l00322"></a>00322   <span class="keywordflow">if</span> (!buffer || buflen==0) return ; 
<a name="l00323"></a>00323   <span class="keywordflow">if</span> (proc) pid=proc-&gt;pid();
<a name="l00324"></a>00324 
<a name="l00325"></a>00325 
<a name="l00326"></a>00326   pos=buffer;
<a name="l00327"></a>00327   <span class="keywordflow">do</span>
<a name="l00328"></a>00328   {
<a name="l00329"></a>00329     p=(<span class="keywordtype">char</span> *)memchr(pos,<span class="charliteral">'\n'</span>,buflen);
<a name="l00330"></a>00330     <span class="keywordflow">if</span> (!p) len=buflen;
<a name="l00331"></a>00331     <span class="keywordflow">else</span> len=p-pos;
<a name="l00332"></a>00332 
<a name="l00333"></a>00333     QByteArray a;
<a name="l00334"></a>00334     a.setRawData(pos,len);
<a name="l00335"></a>00335     QString s(a);
<a name="l00336"></a>00336     kdDebug(11001) &lt;&lt; <span class="stringliteral">"PID"</span> &lt;&lt;pid&lt;&lt; <span class="stringliteral">":"</span> &lt;&lt; s &lt;&lt; endl;
<a name="l00337"></a>00337     a.resetRawData(pos,len);
<a name="l00338"></a>00338     <span class="keywordflow">if</span> (p) pos=p+1;
<a name="l00339"></a>00339     buflen-=len+1;
<a name="l00340"></a>00340   }<span class="keywordflow">while</span>(buflen&gt;0);
<a name="l00341"></a>00341 }
<a name="l00342"></a>00342 
<a name="l00343"></a>00343 
<a name="l00344"></a>00344 <span class="keywordtype">void</span> KMessageProcess::slotReceivedStdout(KProcess * , <span class="keywordtype">char</span> *buffer, <span class="keywordtype">int</span> buflen)
<a name="l00345"></a>00345 {
<a name="l00346"></a>00346   kdDebug(11001) &lt;&lt; <span class="stringliteral">"$$$$$$ "</span> &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Received "</span> &lt;&lt; buflen &lt;&lt; <span class="stringliteral">" bytes over inter process communication"</span> &lt;&lt; endl;
<a name="l00347"></a>00347 
<a name="l00348"></a>00348   <span class="comment">// TODO Make a plausibility check on buflen to avoid memory overflow</span>
<a name="l00349"></a>00349   <span class="keywordflow">while</span> (mReceiveCount+buflen&gt;=mReceiveBuffer.size()) mReceiveBuffer.resize(mReceiveBuffer.size()+1024);
<a name="l00350"></a>00350   memcpy(mReceiveBuffer.data()+mReceiveCount,buffer,buflen);
<a name="l00351"></a>00351   mReceiveCount+=buflen;
<a name="l00352"></a>00352 
<a name="l00353"></a>00353   <span class="comment">// Possbile message</span>
<a name="l00354"></a>00354   <span class="keywordflow">while</span> (mReceiveCount&gt;2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>))
<a name="l00355"></a>00355   {
<a name="l00356"></a>00356     <span class="keywordtype">long</span> *p1=(<span class="keywordtype">long</span> *)mReceiveBuffer.data();
<a name="l00357"></a>00357     <span class="keywordtype">long</span> *p2=p1+1;
<a name="l00358"></a>00358     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len;
<a name="l00359"></a>00359     <span class="keywordflow">if</span> (*p1!=0x4242aeae)
<a name="l00360"></a>00360     {
<a name="l00361"></a>00361       kdDebug(11001) &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Cookie error...transmission failure...serious problem..."</span> &lt;&lt; endl;
<a name="l00362"></a>00362 <span class="comment">//      for (int i=0;i&lt;mReceiveCount;i++) fprintf(stderr,"%02x ",mReceiveBuffer[i]);fprintf(stderr,"\n");</span>
<a name="l00363"></a>00363     }
<a name="l00364"></a>00364     len=(int)(*p2);
<a name="l00365"></a>00365     <span class="keywordflow">if</span> (len&lt;2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>))
<a name="l00366"></a>00366     {
<a name="l00367"></a>00367       kdDebug(11001) &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Message size error"</span> &lt;&lt; endl;
<a name="l00368"></a>00368       <span class="keywordflow">break</span>;
<a name="l00369"></a>00369     }
<a name="l00370"></a>00370     <span class="keywordflow">if</span> (len&lt;=mReceiveCount)
<a name="l00371"></a>00371     {
<a name="l00372"></a>00372       kdDebug(11001) &lt;&lt; k_funcinfo &lt;&lt; <span class="stringliteral">": Got message with len "</span> &lt;&lt; len &lt;&lt; endl;
<a name="l00373"></a>00373 
<a name="l00374"></a>00374       QByteArray msg;
<a name="l00375"></a>00375     <span class="comment">//  msg.setRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));</span>
<a name="l00376"></a>00376       msg.duplicate(mReceiveBuffer.data()+2*<span class="keyword">sizeof</span>(long),len-2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>));
<a name="l00377"></a>00377       emit <a class="code" href="classKMessageIO.html#c2925ec4f163a91f15b037dcd9dc93a2" title="This signal is emitted when /e send() on the connected KMessageIO object is called...">received</a>(msg);
<a name="l00378"></a>00378      <span class="comment">// msg.resetRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));</span>
<a name="l00379"></a>00379       <span class="comment">// Shift buffer</span>
<a name="l00380"></a>00380       <span class="keywordflow">if</span> (len&lt;mReceiveCount)
<a name="l00381"></a>00381       {
<a name="l00382"></a>00382         memmove(mReceiveBuffer.data(),mReceiveBuffer.data()+len,mReceiveCount-len);
<a name="l00383"></a>00383       }
<a name="l00384"></a>00384       mReceiveCount-=len;
<a name="l00385"></a>00385     }
<a name="l00386"></a>00386     <span class="keywordflow">else</span> <span class="keywordflow">break</span>;
<a name="l00387"></a>00387   }
<a name="l00388"></a>00388 }
<a name="l00389"></a>00389 
<a name="l00390"></a>00390 <span class="keywordtype">void</span> KMessageProcess::slotProcessExited(KProcess * <span class="comment">/*p*/</span>)
<a name="l00391"></a>00391 {
<a name="l00392"></a>00392   kdDebug(11001) &lt;&lt; <span class="stringliteral">"Process exited (slot)"</span> &lt;&lt; endl;
<a name="l00393"></a>00393   emit <a class="code" href="classKMessageIO.html#84d97fb77fbd43ea40baa2eec1f45ec5" title="This signal is emitted when the connection is closed.">connectionBroken</a>();
<a name="l00394"></a>00394   <span class="keyword">delete</span> mProcess;
<a name="l00395"></a>00395   mProcess=0;
<a name="l00396"></a>00396 }
<a name="l00397"></a>00397 
<a name="l00398"></a>00398 
<a name="l00399"></a>00399 <span class="comment">// ----------------------- KMessageFilePipe ---------------------------</span>
<a name="l00400"></a>00400 KMessageFilePipe::KMessageFilePipe(QObject *parent,QFile *readfile,QFile *writefile) : <a class="code" href="classKMessageIO.html" title="This abstract base class represents one end of a message connections between two...">KMessageIO</a>(parent,0)
<a name="l00401"></a>00401 {
<a name="l00402"></a>00402   mReadFile=readfile;
<a name="l00403"></a>00403   mWriteFile=writefile;
<a name="l00404"></a>00404   mReceiveCount=0;
<a name="l00405"></a>00405   mReceiveBuffer.resize(1024);
<a name="l00406"></a>00406 }
<a name="l00407"></a>00407 
<a name="l00408"></a>00408 KMessageFilePipe::~KMessageFilePipe()
<a name="l00409"></a>00409 {
<a name="l00410"></a>00410 }
<a name="l00411"></a>00411 
<a name="l00412"></a>00412 <span class="keywordtype">bool</span> KMessageFilePipe::isConnected ()<span class="keyword"> const</span>
<a name="l00413"></a>00413 <span class="keyword"></span>{
<a name="l00414"></a>00414   <span class="keywordflow">return</span> (mReadFile!=0)&amp;&amp;(mWriteFile!=0);
<a name="l00415"></a>00415 }
<a name="l00416"></a>00416 
<a name="l00417"></a>00417 <span class="keywordtype">void</span> KMessageFilePipe::send(<span class="keyword">const</span> QByteArray &amp;msg)
<a name="l00418"></a>00418 {
<a name="l00419"></a>00419   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size=msg.size()+2*<span class="keyword">sizeof</span>(long);
<a name="l00420"></a>00420 
<a name="l00421"></a>00421   <span class="keywordtype">char</span> *tmpbuffer=<span class="keyword">new</span> <span class="keywordtype">char</span>[size];
<a name="l00422"></a>00422   <span class="keywordtype">long</span> *p1=(<span class="keywordtype">long</span> *)tmpbuffer;
<a name="l00423"></a>00423   <span class="keywordtype">long</span> *p2=p1+1;
<a name="l00424"></a>00424   memcpy(tmpbuffer+2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>),msg.data(),msg.size());
<a name="l00425"></a>00425   *p1=0x4242aeae;
<a name="l00426"></a>00426   *p2=size;
<a name="l00427"></a>00427   
<a name="l00428"></a>00428   QByteArray buffer;
<a name="l00429"></a>00429   buffer.assign(tmpbuffer,size);
<a name="l00430"></a>00430   mWriteFile-&gt;writeBlock(buffer);
<a name="l00431"></a>00431   mWriteFile-&gt;flush();
<a name="l00432"></a>00432   <span class="comment">/*</span>
<a name="l00433"></a>00433 <span class="comment">  fprintf(stderr,"+++ KMessageFilePipe:: SEND(%d to parent) realsize=%d\n",msg.size(),buffer.size());</span>
<a name="l00434"></a>00434 <span class="comment">  for (int i=0;i&lt;buffer.size();i++) fprintf(stderr,"%02x ",buffer[i]);fprintf(stderr,"\n");</span>
<a name="l00435"></a>00435 <span class="comment">  fflush(stderr);</span>
<a name="l00436"></a>00436 <span class="comment">  */</span>
<a name="l00437"></a>00437 }
<a name="l00438"></a>00438 
<a name="l00439"></a>00439 <span class="keywordtype">void</span> KMessageFilePipe::exec()
<a name="l00440"></a>00440 {
<a name="l00441"></a>00441 
<a name="l00442"></a>00442   <span class="comment">// According to BL: Blocking read is ok</span>
<a name="l00443"></a>00443   <span class="comment">// while(mReadFile-&gt;atEnd()) { usleep(100); }</span>
<a name="l00444"></a>00444 
<a name="l00445"></a>00445    <span class="keywordtype">int</span> ch=mReadFile-&gt;getch();
<a name="l00446"></a>00446 
<a name="l00447"></a>00447    <span class="keywordflow">while</span> (mReceiveCount&gt;=mReceiveBuffer.size()) mReceiveBuffer.resize(mReceiveBuffer.size()+1024);
<a name="l00448"></a>00448    mReceiveBuffer[mReceiveCount]=(char)ch;
<a name="l00449"></a>00449    mReceiveCount++;
<a name="l00450"></a>00450 
<a name="l00451"></a>00451    <span class="comment">// Change for message </span>
<a name="l00452"></a>00452    <span class="keywordflow">if</span> (mReceiveCount&gt;=2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>))
<a name="l00453"></a>00453    {
<a name="l00454"></a>00454      <span class="keywordtype">long</span> *p1=(<span class="keywordtype">long</span> *)mReceiveBuffer.data();
<a name="l00455"></a>00455      <span class="keywordtype">long</span> *p2=p1+1;
<a name="l00456"></a>00456      <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len;
<a name="l00457"></a>00457      <span class="keywordflow">if</span> (*p1!=0x4242aeae)
<a name="l00458"></a>00458      {
<a name="l00459"></a>00459        fprintf(stderr,<span class="stringliteral">"KMessageFilePipe::exec:: Cookie error...transmission failure...serious problem...\n"</span>);
<a name="l00460"></a>00460 <span class="comment">//       for (int i=0;i&lt;16;i++) fprintf(stderr,"%02x ",mReceiveBuffer[i]);fprintf(stderr,"\n");</span>
<a name="l00461"></a>00461      }
<a name="l00462"></a>00462      len=(int)(*p2);
<a name="l00463"></a>00463      <span class="keywordflow">if</span> (len==mReceiveCount)
<a name="l00464"></a>00464      {
<a name="l00465"></a>00465        <span class="comment">//fprintf(stderr,"KMessageFilePipe::exec:: Got Message with len %d\n",len);</span>
<a name="l00466"></a>00466 
<a name="l00467"></a>00467        QByteArray msg;
<a name="l00468"></a>00468        <span class="comment">//msg.setRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));</span>
<a name="l00469"></a>00469        msg.duplicate(mReceiveBuffer.data()+2*<span class="keyword">sizeof</span>(long),len-2*<span class="keyword">sizeof</span>(<span class="keywordtype">long</span>));
<a name="l00470"></a>00470        emit <a class="code" href="classKMessageIO.html#c2925ec4f163a91f15b037dcd9dc93a2" title="This signal is emitted when /e send() on the connected KMessageIO object is called...">received</a>(msg);
<a name="l00471"></a>00471        <span class="comment">//msg.resetRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));</span>
<a name="l00472"></a>00472        mReceiveCount=0;
<a name="l00473"></a>00473      }
<a name="l00474"></a>00474    }
<a name="l00475"></a>00475    
<a name="l00476"></a>00476 
<a name="l00477"></a>00477    return ;
<a name="l00478"></a>00478 
<a name="l00479"></a>00479   
<a name="l00480"></a>00480 }
<a name="l00481"></a>00481 
<a name="l00482"></a>00482 <span class="preprocessor">#include "kmessageio.moc"</span>
</pre></div></div>
    </div></div>


      </td>
  </tr>
  <tr>
    <td valign="top" id="leftmenu" width="25%">
      <a name="navigation"></a>
      <div class="menu_box"><h2>libkdegames</h2>
<div class="nav_list">
<ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul>
<!--
<h2>Class Picker</h2>
<div style="text-align: center;">
<form name="guideform">
<select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value">
<option value="annotated.html">-- Choose --</option>
  <option value="classKCanvasRootPixmap.html">kcanvasrootpixmap</option>,  <option value="classKCardDialog.html">kcarddialog</option>,  <option value="classKChat.html">kchat</option>,  <option value="classKChatBase.html">kchatbase</option>,  <option value="classKChatBaseText.html">kchatbasetext</option>,  <option value="classKExtHighscore_1_1Item.html">kexthighscore::item</option>,  <option value="classKExtHighscore_1_1ItemArray.html">kexthighscore::itemarray</option>,  <option value="classKExtHighscore_1_1Manager.html">kexthighscore::manager</option>,  <option value="classKExtHighscore_1_1MultiplayerScores.html">kexthighscore::multiplayerscores</option>,  <option value="classKExtHighscore_1_1Score.html">kexthighscore::score</option>,  <option value="classKGame.html">kgame</option>,  <option value="classKGameChat.html">kgamechat</option>,  <option value="classKGameComputerIO.html">kgamecomputerio</option>,  <option value="classKGameConnectDialog.html">kgameconnectdialog</option>,  <option value="classKGameDialog.html">kgamedialog</option>,  <option value="classKGameDialogChatConfig.html">kgamedialogchatconfig</option>,  <option value="classKGameDialogConfig.html">kgamedialogconfig</option>,  <option value="classKGameErrorDialog.html">kgameerrordialog</option>,  <option value="classKGameErrorMessageDialog.html">kgameerrormessagedialog</option>,  <option value="classKGameIO.html">kgameio</option>,  <option value="classKGameKeyIO.html">kgamekeyio</option>,  <option value="classKGameLCD.html">kgamelcd</option>,  <option value="classKGameLCDClock.html">kgamelcdclock</option>,  <option value="classKGameLCDList.html">kgamelcdlist</option>,  <option value="classKGameMisc.html">kgamemisc</option>,  <option value="classKGameMouseIO.html">kgamemouseio</option>,  <option value="classKGameNetwork.html">kgamenetwork</option>,  <option value="classKGameProcess.html">kgameprocess</option>,  <option value="classKGameProcessIO.html">kgameprocessio</option>,  <option value="classKGameProgress.html">kgameprogress</option>,  <option value="classKGameProperty.html">kgameproperty</option>,  <option value="classKGamePropertyBase.html">kgamepropertybase</option>,  <option value="classKGamePropertyHandler.html">kgamepropertyhandler</option>,  <option value="classKGameSequence.html">kgamesequence</option>,  <option value="classKGrid2D_1_1Generic.html">kgrid2d::generic</option>,  <option value="classKGrid2D_1_1Hexagonal.html">kgrid2d::hexagonal</option>,  <option value="classKGrid2D_1_1HexagonalBase.html">kgrid2d::hexagonalbase</option>,  <option value="classKGrid2D_1_1Square.html">kgrid2d::square</option>,  <option value="classKGrid2D_1_1SquareBase.html">kgrid2d::squarebase</option>,  <option value="classKHighscore.html">khighscore</option>,  <option value="classKMessageClient.html">kmessageclient</option>,  <option value="classKMessageDirect.html">kmessagedirect</option>,  <option value="classKMessageIO.html">kmessageio</option>,  <option value="classKMessageServer.html">kmessageserver</option>,  <option value="classKMessageServerSocket.html">kmessageserversocket</option>,  <option value="classKMessageSocket.html">kmessagesocket</option>,  <option value="classKPlayer.html">kplayer</option>,  <option value="classKScoreDialog.html">kscoredialog</option>,  <option value="classKStdGameAction.html">kstdgameaction</option>,
</select>
</form>
</div>
-->
</div></div>
<div class="menu_box"><h2>API Dox</h2>
<div class="nav_list">
<ul>
<li><a href="../../libkdegames/html/index.html">libkdegames</a></li>
</ul></div></div>


        </td>
</tr>
</table>

<span class="doNotDisplay">
  <a href="http://www.kde.org/" accesskey="8">KDE Home</a> |
  <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> |
  <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a>
</span>


<div style="height: 8px"></div>

<div id="footer">
  <div id="footer_left">
    Maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">Allen Winter</a>.
<br/>
    KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
    <a href="http://www.kde.org/contact/impressum.php">Legal</a>
  </div>
  <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div>
</div>

<!--
WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL
BE BLOCKED INSTANTLY AND PERMANENTLY!
<a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a>
WARNING END
-->

</body>
</html>