Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Batch on a VM

Status
Not open for further replies.

jimmy1981

Programmer
Jul 20, 2011
2
GB
Hi,

I have a program in foxpro that runs a batch file to connect to a server to copy some files, when i run the program the first time it stalls at connected to (ip add) and then times out.

when i close it and run again it runs successfully, i get the server ready and it pulls the ftp details from my dat file.

any ideas why the first time it runs it cant connect? but after that it does?

Thanks,
Jimmy
 
Put your connection routine twice in the program, first to connect and do nothing and handle the error, and second to do the business.

You may have a wakeup issue
 
Well I guess that it could be an FP question if is was about error-handling.

How should they, within their FP code, handle, prevent, or recover from the error condition where the FTP connection fails?

The question is - when they say: foxpro that runs a batch file - Is this work actually being done within the FP code or in some external code within some 'batch' file?

If the later, then NO, it is not 'as is' an FP question.

But could the 'batch file' work be done in FP itself using WinAPI's?
It might be worth their looking into:

jimmy1981 - Good Luck,
JRB-Bldr
 
Batch files run externally. There is nothing inside FPD/FPW to trap.

Within the batch file itself, you can often trap errors *IF* (and this is a big IF) the application you're calling sets the DOS ERRORLEVEL on exit. You can't trap this inside FP because by the time your application regains control the command.com session has ended and any existing ERRORLEVEL has been discarded.

You need to examine the batch file and see what, exactly, is being called. You may have to do some fiddling to figure out whether it sets ERRORLEVEL.

Good luck!
 
Thanks for the replies, wasnt sure where to put the question TBH.

It looks like it's a problem between the virtual machine and the server, so trying a work-around where it connects 1st time and timesout after 10 seconds and then connects again to do the file transfer.

Batch just seems to hang waiting for the response from the server and then timesout, run it again and no problems so hopefully the workaround will do the job.

thanks for the help and aplogies it was put here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top