Is it possible to autodetect active or passive mode on the connected ftp client. If so, how?

asked 30 Mar '10, 15:11

Will's gravatar image

Will
161
accept rate: 0%

edited 30 Mar '10, 15:39

Martin%20Vobr's gravatar image

Martin Vobr ♦♦
335310


Finding whether the server allows passive or active mode is a bit tricky.

To detect whether passive mode is possible, we have to improvise a bit. One possible way to do this with Rebex FTP:

  1. Make sure passive mode is enabled
  2. Lower the timeout from the default value of 60 seconds to something like 5 (or even leave it at 60 if detection speed is not an issue for you)
  3. Initiate a TransferProgress event handler
  4. Try calling GetList or GetNameList (preferably on a folder with few files) 4.
    • If the event handler is called at least once with state of FtpTransferState.Downloading, consider passive mode possible
    • If you get an FtpException with the Status set to Timeout, consider passive mode not impossible
    • If you get an FtpException with the Status set to ConnectFailure, consider passive mode not impossible
    • If you get other result, another error occured

Anyway, this seems rather complicated, so I added it into our list of possible future enhancements.

Vote the question up if it's important to you.

link

answered 30 Mar '10, 15:38

Martin%20Vobr's gravatar image

Martin Vobr ♦♦
335310
accept rate: 37%

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:

×136
×5
×4
×2

Asked: 30 Mar '10, 15:11

Seen: 1,255 times

Last updated: 30 Mar '11, 07:22