West Wind Internet and Client Tools
FTPGetFileEx Question
Gravatar is a globally recognized avatar based on your email address. FTPGetFileEx Question
  Steve
  All
  Oct 7, 2019 @ 10:42am

Hi All,
Is there anyone that can share an example that implements/uses the lCancelDownload and OnFTPBufferUpdate functions of FTPGetFileEx please?

Sometimes, the file download fails, and this can take like 1 or 2 minutes before it comes back with the file download failed message. My hope is to detect when the file is not downloading and cancel say within about 30 seconds.

TIA,
Steve

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Rick Strahl
  Steve
  Oct 7, 2019 @ 12:51pm

This is a tricky issue mainly because it requires coordination between the client and the server. In my experience most failures are due to drastically slowing connections (ie. there's still a trickle of data) that doesn't trigger a timeout, which is why it often doesn't fail when you think it should.

I don't think there are good solutions beyond using short timeouts - 30 seconds is too long IMHO. Timeouts should be in the 10-15 second range and I think the Windows default is 20.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Steve
  Rick Strahl
  Oct 7, 2019 @ 07:28pm

I saw the nConnectTimeout, but didn't see a timeout parm for the file download. What can I use to specify a timeout for the file download?

Thanks,
Steve

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Rick Strahl
  Steve
  Oct 7, 2019 @ 10:21pm

The connection timeout is applied throughout the connection including send and receive.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Steve
  Rick Strahl
  Nov 14, 2019 @ 02:05pm

Hi All,
Is there any way to detect if the Windows Firewall is blocking an FTP connection being initiated via wwFTP?

Also, today I noticed something really weird. I have 4 instances of a VFP9 App running on a single machine. Each instance is the same, but uses different data and is located in a different folder. They each use the WWWC wwFTP Utility to download file updates. When the FTP Connection cannot be made, the titlebar will show - Not Responding, and will eventually timeout. This was happening on one of the instances today. Then, all of a sudden all 4 instances started showing - Not Repsonding. Not only that, I was running a different VFP App on the same computer, which is a completely separate and different VFP9 app, and it also showed - Not Responding at the same time the other 4 VFP9 apps were doing it. Once the FTP Connection timed out on the first instance, they all started responding normally, including the separate VFP9 app. I am pretty sure in this case, the Windows Firewall was preventing the conneciton. These apps are running on a Win7Pro box and it seems sometimes the firewall settings get scrambled. A reboot normally fixes, or adding the apps back into the firewall.

Has anyone ever seen such behavior, where one VFP9 App stops responding, and other instances of the same app does the same? Also, the separate VFP9 App, which also stopped responding, was not doing any file downloads when the issue occurred. Kind of stumped. Appreciate any feedback you may have.

TIA,
Steve

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Rick Strahl
  Steve
  Nov 14, 2019 @ 08:09pm

Steve,

Yes - when it fails 😃

No there's no information available detect what's actually causing requests to fail to connect. Usually firewall issues fail immediately because they are blocked locally and returned immediately. If you're hanging the issue is either a bad network name as the client tries to the find the server to connect to, or a server that accepts a connection and then doesn't continue (or there's a protocol error that effectively hangs the socket connection). Given that you have the UI hanging issue I suspect the former with the network stack hunting for a connection that it can't locate.

The problem with the 'hanging' is because the WinInet in Windows and the Windows Network stack aren't fully thread safe (even across processes). Network hangs (as you probably have seen in Windows in general when you have a disconnected network drive and open Explorer) can hang the UI for any visible application that has an event loop (as FoxPro does).

+++ Rick --

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Steve
  Rick Strahl
  Nov 15, 2019 @ 12:46pm

Now this one made me laugh out loud 😃
Yes - when it fails ??

Thanks for the feedback Rick, very helpful!!

Gravatar is a globally recognized avatar based on your email address. re: FTPGetFileEx Question
  Rick Strahl
  Steve
  Nov 15, 2019 @ 03:46pm

Forgot to mention that you can play around with the connection timeout. The default timeout is something like 20 seconds, which is pretty long. I think short timeouts of a 5-10 seconds is more than enough - if a connection takes that long to connect it likely isn't working. By minimizing the timeout you're reducing the pain and also Windows doesn't white screen (thinks app is unresponsive) until a few seconds have passed.

+++ Rick ---

© 1996-2024