title: C++ TCP socket garbage value
body: <p>I have my socket comms pretty much working. The only thing that I'm not sure about is why I'm getting some garbage values at the end of my message. The first message I send contains some extra characters at the end, and every message after that is as expected...does anyone have any insight as to why this is happening?</p>
  
  <p><strong>Send:</strong></p>
  
  <pre><code>CString string = "TEST STRING TO SEND";
  char* szDest;
  szDest = new char[string.GetLength()];
  strcpy(szDest,string);
  m_pClientSocket-&gt;Send(szDest,strlen(pMsg));
  </code></pre>
  
  <p><strong>Receive: (this is using Qt)</strong></p>
  
  <pre><code>char* temp;
  int size = tcpSocket-&gt;bytesAvailable();
  temp = new char[size];
  tcpSocket-&gt;read(temp,size);
  </code></pre>