Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.9k views
in .NET FTP by
I'm wondering how you go about getting status updates during the file transfer?

Here is my simple test code that I am experimenting with:

FTPClient ftp = new FTPClient();
ftp.RemoteHost = textBoxFTPServer.Text;
ftp.Connect();
ftpOutput.AppendText("Connected to " + textBoxFTPServer.Text + "\n");
         ftp.Login(textBoxFTPUser.Text,textBoxFTPPassword.Text);
ftpOutput.AppendText("Login as " + textBoxFTPUser.Text + " successful.\n");
ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.BINARY;
ftpOutput.AppendText("Sending file " + remoteFile + "...\n");
ftp.Put(localFile,remoteFile);
ftpOutput.AppendText("Bytes transferred: " + ftp.Size(remoteFile) + "\n");
ftp.Quit();


If anyone can point me in the right direction for getting status updates it would be very helpful.

Thanks!
-Steve

2 Answers

0 votes
by (162k points)
Have a look in the Dev Guide at the section on events.

Here's a snippet of code - see FTPTestCase.cs for more.

// connect
            ftp = new FTPClient();
            ftp.RemoteHost = host;
            ftp.ControlPort = FTPControlSocket.CONTROL_PORT;
            ftp.Timeout = timeout;
            ftp.ConnectMode = connectMode;
            ftp.TransferStartedEx += new TransferHandler(LogTransferStarted);
            ftp.TransferCompleteEx += new TransferHandler(LogTransferComplete);
            ftp.BytesTransferred += new BytesTransferredHandler(BytesTransferred);



I'm wondering how you go about getting status updates during the file transfer?
0 votes
by
That did the trick! Thanks for the quick reply!

Categories

...