title: TCP IP socket.receive, data received in .Net application but not in Unity
body: <p>I send data via TCP from a .NET application to Unity but all bytes aren't received. This is the case with a simple .NET wpf application with the same code. Why is there a difference in Unity? Both is based on .NET 4.7?</p>
  
  <pre><code>// Data send from .NET application: 
  byte[] ba = memoryStream.ToArray();
  var buffer = BitConverter.GetBytes(ba.Length);
  stm.Write(buffer, 0, buffer.Length);
  stm.Write(ba, 0, ba.Length);
  
  // Data receive works in .NET but in Unity not all bytes are received
  Socket s;
  byte[] buffersizeinbytes = new byte[32];
  TcpListener myList = new TcpListener(ipAd, 8001);
  s = myList.AcceptSocket();
  (...)
  int k = s.Receive(buffersizeinbytes);
  int size = BitConverter.ToInt32(lengthb, 0); // size of buffer
  byte[] buffer = new byte[size]; 
  int receivedByteCount = s.Receive(buffer);
  </code></pre>