title: Inter process communication between C# and C++ (using QT4.8)
body: <p>I am facing issue in passing data between c# and C++ (QT) application through named pipe communication. C# client application connects to NamedPipe server which is in c++ but message is not being parsed correctly on server. Example, I am sending value of short variable = 2 and c++ code parse byte array into unsigned int but value is coming always zero in server. Could you please let me know what I am doing wrong?</p>
  
  <p><strong>Client and server code:</strong></p>
  
  <p><strong>NamedPipe Server code in C++ using QT Library</strong> </p>
  
  <pre><code>  QLocalSocket *local_socket = _local_server-&gt;nextPendingConnection();
  
  if (!local_socket-&gt;waitForReadyRead(gft::PROC_TIMEOUT)) {
      qDebug() &lt;&lt; "gft_plugin: timeout while waiting for data";
      return;
  }   
  
  int bytesavailable = local_socket-&gt;bytesAvailable();
  
  QByteArray buffer;
  QDataStream in(&amp;buffer, QIODevice::ReadOnly);
  buffer.append(local_socket-&gt;readAll());
  
  unsigned int msg;
  in &gt;&gt; msg;
  
  unsigned int a_id = msg;
  </code></pre>
  
  <p><strong>NamedPipe Client (C#)</strong></p>
  
  <pre><code>        var clientStream = new NamedPipeClientStream("localhost", "gft_plugin_server", PipeDirection.InOut);
          clientStream.Connect();
  
          if (clientStream.IsConnected)
          {
              _stop = false;
              UInt16 a_id = 2;
  
              byte[] b = BitConverter.GetBytes(a_id);
  
              clientStream.Write(b, 0, b.Count());
              clientStream.Flush();
  
          }
          else
          {
              MessageBox.Show("Could not connected");
          }
  </code></pre>