login about faq

Hello!

i am using async calls to avoid locking the interface and do other work while uploading with the ftp2 library. Problem is the connect function! if some settings or the login data is wrong then this call locks the interface until the connection times out.. (60 seconds)

is there a way to avoid having all locked for 60 seconds? thanks

asked May 18 '14 at 15:58

sharkyenergy's gravatar image

sharkyenergy
5081621


If your program is single-threaded, then Yes -- a call into a method will block the program's main thread form servicing the UI because it is busy within the method that is being called.

There are several solutions, depending on your programming language:

  1. Explicitly create a background thread and make the call there, which allows the main (foreground) thread to continue servicing the UI.
  2. Use AbortCheck event callbacks (with the HeartbeatMs property set to a small value, such as 20ms) to update the UI from within AbortCheck callbacks.
  3. Set the ConnectTimeout property to a smaller value (smaller than the default of 60 seconds).
link

answered May 19 '14 at 08:09

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Thank you! If i go for solution 1 and would like to have 8 parallel uploads with 8 instances of ftp2, would i need 8 threads? Isnt that too much for a program? Why is the async locking the program here but not on the vb.net version? Thanks

(May 19 '14 at 08:23) sharkyenergy
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×131
×34
×23
×2

Asked: May 18 '14 at 15:58

Seen: 2,104 times

Last updated: May 19 '14 at 08:23

powered by OSQA