title: Socket.Receive does not block until all data is received
body: <p>Ai!</p>
  
  <p>I'm trying to get a ftp file list and already got a small library which did that. Thing is that the Socket.Receive() function does not block until all data is received. When i set a breakpoint at that line it receives all data but if i don't do that there are only 38 bytes (should be around 380).</p>
  
  <p>Here is the code:</p>
  
  <pre><code>While True
      Dim bytes As Integer = cSocket.Receive(buffer, buffer.Length, SocketFlags.None)
      mes += ASCII.GetString(buffer, 0, bytes)
      If bytes &lt; buffer.Length Then
          Exit While
      End If
  End While
  </code></pre>
  
  <p>As i said: it works if the breakpoint is set in the line with the .Receive part. I could use a workaround that guarantees one extra loop but that seems to be very dirty. Any ideas?</p>
  
  <p>//edit: so let me add some more information. I don't know how much data i will receive. The code is from a function that receives data from a ftp server. I thought i could stop when the message ends with CRLF but i can't do that because there is a CRLF between each file that is listed. Example:
  file1.textCRLFfile2.txtCLRFfile3.txtCRLF</p>
  
  <p>Sometimes when i call receive it only returns one file with a CRLF at the end even if there are more files to be listed. So this condition seems unstable to me.</p>