ftp woes (1 Viewer)

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 10:11
Joined
Sep 12, 2006
Messages
15,613
VBA code to run an ftp script is failing, but only on some computers.

The script logs in to an ftp site, does an ls to get a file listing, then does an mget * to collect the files

filename is a text file with a sequence of commands for ftp to implement

From the OS prompt this works
ftp -ns:"filename"

from within access this fails (hangs while executing)
shell(ftp -ns:"filename")

it's nothing to do with the syntax of the command. It's formatted correctly, runs, opens a command window and logs in. On some PC's it then completes normally. On others it gets to the first i/o command, echoes it in the command window, but hangs. It hangs at the ls command. If I remove the ls it hangs at the mget * command.

Has anybody got any ideas how to get round this?

Please note that the real code is actually slightly different to this. It actually calls a shell and wait routine to hold further processing until the ftp script completes, but I have just pared it back to this simple "shell" instruction, to just try to get it running, and pinpoint precisely what is causing the problem.

I had the same problem on a different computer, and got around it by using WINSCP instead of ftp, but we would like to solve the problem affecting ftp.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:11
Joined
Feb 28, 2001
Messages
26,996
The way to get around the roadblock is to figure out why it is there and having fought FTP on Windows as well as mainframes, I can tell you it is a nightmare from the outside.

For one of the failing cases, try to turn on FTP's Verbose mode (-v) at the start of the procedure. Then check the FTP log file after it hangs and you clean it up. You MIGHT have to check the side where FTPD.EXE runs as well as the FTP.EXE side.

Let's HOPE that you don't have to boost debug mode to figure this out. (Option "-d nn") where if you have to go more than -d 5 you will hate me for the rest of your life at having to go through that nightmare.
 

sonic8

AWF VIP
Local time
Today, 11:11
Joined
Oct 27, 2015
Messages
998
VBA code to run an ftp script is failing, but only on some computers.
Do they all connect to the same FTP server or to different ones?
Do the FTP commands work when you enter them manually?


I suspect your problem might be connected to FTP-Active/Passive-Mode and the firewall configuration for some computers or their network.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 10:11
Joined
Sep 12, 2006
Messages
15,613
@sonic

If I go to the windows prompt, enter ftp, and then enter the commands manually, it all works. If I enter ftp -ns:scriptname directly at the windows prompt it works.

But if I try to shell "ftp -ns:scriptname" it gives me a windows handle, runs and logs in, but fails on the first i/o command. (ie it hangs on ls, but if I remove ls from the command file, then it hangs with the mget *)

It may not even be ftp. even I wondered if access was failing to grant appropriate to the ftp process, but I can't think an ls would hang ….
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:11
Joined
Feb 28, 2001
Messages
26,996
Active/Passive might be a good guess, Sonic8. I though about firewall configuration but then thought about it some more. The firewall configuration is (I think) ruled out by the fact that it hangs AFTER the connection is established. My experience with firewalls tells me that if it were the firewall, the connection would never occur. I don't think it has to do with permissions, either, because it works when done manually. That's why I asked about turning on verbose mode. You get a few more error and status messages that way.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:11
Joined
Feb 28, 2001
Messages
26,996
Dave, a question occurs to me. When the process hangs, use task manager to show you ALL processes and determine whether FTP is running as you or as SYSTEM. Created processes SHOULD run as you, but in the case that Access created it, there is that nagging question in my mind to rule out the easily dismissed possibilities. Since it is a simple test, it should not be too much to do.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 10:11
Joined
Sep 12, 2006
Messages
15,613
@TheDocMan

Can you tell me where the log gets stored.
I saw a reference to C:\windows\system32\logfiles, but I can't see anything there.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 10:11
Joined
Sep 12, 2006
Messages
15,613
Dave, a question occurs to me. When the process hangs, use task manager to show you ALL processes and determine whether FTP is running as you or as SYSTEM. Created processes SHOULD run as you, but in the case that Access created it, there is that nagging question in my mind to rule out the easily dismissed possibilities. Since it is a simple test, it should not be too much to do.

Could be. I will report this possibility back to the system experts, as its getting outside my comfort zone.

ftp seems to be showing in the properties window as
GROUP: all application packages
PERMISSIONS: Just Read and Read/Execute
 

Users who are viewing this thread

Top Bottom