login about faq

Hi, (C#, .Net 4.5.2, Chilkat, Ftp2, Ftp2.ConnectAsync())

I'm trying to use the OnTaskCompleted-Event on the Ftp2 class. The Synchronous method (Connect()) works perfectly. Also the async method when using task.Wait(0). But I'd like to us ethe OnTaskCompleted-Event to don't block my thread. My code snippet:

        var tcs = new TaskCompletionSource<bool>();
        var t1 = ftp.ConnectAsync();
        t1.OnTaskCompleted += (sender, args) => {
            var t2 = args.Task;

        if (!t1.Run()) {
        return tcs.Task;

But my Task never finishes because OnTaskCompleted is not invoked.

Thanks in advance

asked Dec 30 '15 at 03:21

Stefan%20O's gravatar image

Stefan O

I know this is confusing, but the event is actually on the ftp object, not the Task object.

ftp.OnTaskCompleted += ....


answered Dec 30 '15 at 08:05

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Dec 30 '15 at 03:21

Seen: 516 times

Last updated: Dec 30 '15 at 08:05

powered by OSQA