Consecutive uploads with same FtpClient

Sep 30, 2012 at 9:05 PM

I ran into trouble trying to upload multiple files consecutively using the same FtpClient:

using (FtpClient client = ...) {

   foreach (string path in list) {

       client.Upload(path, Path.GetFileName(path));


The problem appears to be that when FtpClient.cs Upload() calls istream.close(), my FTP server (FileZilla) sends a "226 transfer OK" response. That response is not read anywhere so it remains in the response stream. So the next command that the client sends, when the client tries to read the response, it gets the 226 instead of what it expects.

Am I doing something wrong? Adding a this.ReadResponse() after the istream.Close() fixed the problem but I barely know what I'm doing.

Thanks for the great work, this library is very helpful.

Oct 1, 2012 at 1:22 AM

Which revision are you using? There should be no issue, in fact I run the unit tests project against filezilla doing consecutive uploads and downloads. It may be a bug introduced in one of the newer revisions which I haven't tested.

Oct 1, 2012 at 1:23 AM

Also, it will be tomorrow morning before I can work on it, will try to get it addressed in the AM.

Oct 1, 2012 at 3:20 AM

I was working with the latest release, 2012-08-08. I downloaded the latest source code and indeed it now works without my change. Thanks for the quick response.