226 response not received from some ftp servers
Brought to you by:
boudartjj
On a DIR command, the code currently expects to either
receive the responses right away or expects to receive
the 226 after the file list is read. However, some ftp
servers don't return the 226 until after the data
channel is closed. In this case, because the data
channel is closed after the message is read, an
erroneous error message about "ftp comment not received
from server" is generated. Moving the following code
in the Dir() method solves the problem:
networkStream = client.GetStream();
fileList = ReadLines(networkStream);
// these two lines were after the message read but
should be here
networkStream.Close();
client.Close();
Logged In: YES
user_id=1218689
This fix works for me too.
Hi,
I fixed it by allowing all ok status codes to be accepted as ok in Dir command and others
Allow status codes 200 - 299 to be ok. I also fixed this part that you write here in same way. Thx.
networkStream.Close();
client.Close();
if (this.mode == FTPMode.Active) {
listner.Stop();
}