Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FTP error on loop
Message
From
08/02/2017 16:07:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
West Wind Web Connection
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows Server 2008 R2
Network:
Windows Server 2008 R2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01647704
Message ID:
01647725
Views:
46
>Hi all,
>I have a program that will upload a file via FTP to a remote server. It works well is there is just 1 file, however if there are multiple files then I get an error on the 2nd and subsequent files about variable nFtpPort. the code that I call is below and I pass the variable correctly as it works when there is only 1 file. Any help appreciated as I'm a bit stuck.
>
>
PARAMETERS pcServer,pnPort,pcUser,pcPass,pcLocalName,pcFtpName
>
>SET PROCEDURE TO wwftp addi
>
>LOCAL o as wwFtp
>
>o=create("wwFTP")
>
>o.lPassiveFtp = .T.
>
>o.nFtpPort = pnPort
>
>? o.FTPConnect(pcServer,pcUser,pcPass)
>
>? o.FtpSendFileEx2(pcLocalName,pcFtpName)
>
>o.FtpClose()
>
>o=null
>
>WAIT clear
Are you calling all of this for each file? The possible cause then is that some ftp sites won't allow too many connections from the same address within some time. You should check error codes and error messages that your ftp object is surely catching. I'm using ftp_service by Robert Abram, Martina Jindrová et al, and there I have
		with this.oHandler
			if	.getextendederrorCode()=0
				lcMsg="OK " + .getextendederrormsg()
			else
				lcMsg="error - "+.getextendederrormsg()
			endif
		ENDWITH
The resulting string is then logged so I know what went on. One thing I noticed on my website is that if I send files, then quickly after that send some more, after a couple of times it would just kick me off with "too many connections from the same IP in short time" or some such excuse. So perhaps you should connect, do your files, disconnect - IOW keep the connection open, not open/close for every file.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform