0 votes
by (160 points)

.Net Compact Framework 3.5
Windows Compact 7

Hello Rebex Team,
I'm new here therefore a possibly simple / unusual question.
I still use the trial version but would soon like to buy the full version.
First of all kudos to the developers who have developed such a great product. The tutorials are very helpful too.
Unfortunately I could not answer my question sufficiently, why I announce myself here with you.
I use the PocketFTP to send files via FTP. For the purpose of finding an error, I need a detailed description of the error, if FTP files were not completely transferred. (No data connection, login error, FTP client access denied, file too long, FTP connection disconnected from client ...)
As far as I could see the PocketFTP uses the function UploadFile. Now this is an asynchronous procedure where I have to query the error differently. As far as I understand it, TransferCallback (IAsyncResult asyncResult) handles the upload.
I suspect that IAsyncResult is the class for the error code, but I'm not sure.
Can you please tell me how to get the error code from UploadFile?
Thank you very much.
Best regards
Saphymo

1 Answer

0 votes
by (144k points)

Rebex libraries such as Rebex FTP/SSL support three kinds of API:

  • Synchronous API. This is straightforward, simple to use, and recommeded if you are new to Rebex libraries and to .NET's asynchronous API.
  • Legacy IAsyncResult-based asynchronous API. This is called Asynchronous Programming Model (APM) and it has been introduced by Microsoft in .NET 1.0. Check out Microsoft Docs for an overview. Simply said, you start a background operation by calling BeginUpload method, which returns IAsyncResult immediatelly and invokes the callback when the operation is finished (or fails). At that point, you call EndUpload method to retrieve the result. If an error occurred during the operation, the EndUpload method would raise an exception.
  • Task-based API. This API is recommened for new asynchronous application, but it's only available in .NET 4 and later.
...