I am trying to retrieve a file list from a ftp. I got this code from
the microsoft website:
Do While (True)
m_aBuffer.Clear(m_aBuffer, 0, m_aBuffer.Length)
bytes = cSocket.Receive(m_aBuffer, m_aBuffer.Length,
SocketFlags.None)
m_sMes += ASCII.GetString(m_aBuffer, 0, bytes)
Console.WriteLine(m_sMes)
If (bytes < m_aBuffer.Length) Then
Exit Do
End If
Loop
This code works fine if I put a break after the Socket.Receive. The
number of bytes it should return is 380. If I put a break after the
receive all 380 get transferred. If I don't put a break in the code,
the app seems to run to fast and only returns 20 bytes.
Should the code stop to receive everything before continuing? Am I
doing something wrong here?
Thanks