0 votes
by (320 points)
edited

Hello,

We have implemented like the below way to get the directories and files list from FTP client object.

                IAsyncResult ar = client.BeginGetList(null, null);
                while (!ar.IsCompleted)
                {
                    if (isFromObjects == false)
                    {
                        Application.DoEvents();
                    }
                    System.Threading.Thread.Sleep(1);
                }
                FtpList fileFolderList = client.EndGetList(ar);

Now we have upgraded to latest 2014 R2 version. In the latest version we are getting build errors that the BeginGetList and EndGetList methods are not found in latest 2014 R2 FTP client object.

Earlier we have copied the above code from sample application which Rebex has provided.

Please help me resolve the above issue.

Regards, Shahin.

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (58.9k points)
edited

Hello,

since release 2012R3 the old async API BeginXYZ/GetXYZ methods are not accessible under .NET 4.0 / .NET 4.5. However, you can still get access to them, just add

using Rebex.Legacy;

namespace into your program and your old code will work as before.

See more info about upgrading from 2012R2 or older.

by (320 points)
edited

Hello Tomas,

Actually this code I have copied from earlier version of Rebex. Can I remove these lines of code and write like below ?

FtpList list = _ftp.GetList();

Regards, Shahin

by (58.9k points)
edited

If you do not need the operation to be executed in background then the normal Ftp.GetList method is suitable for you.

by (320 points)
edited

If we want to execute in background, what is the code I need to write in latest 2014 R2 version?

by (58.9k points)
edited

Well, if you have a working solution I guess it is really the best to add the

using Rebex.Legacy;

namespace and keep using the old style async code. Are you able to compile and run after importing the Rebex.Legacy namespace? If not please let us know.

...