[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FTP_Open Timeout



Hello,

> I'm using the FTP_Logging procedure, so therefore I'm using FTP_Open
> and FTP_Login (since the FTP_Logging call needs to be between them).
> Question - how can I enforce a timeout on FTP_Login?

The timeout is the 3rd parameter to FTP_Open().  Once you've set the 
timeout there, it's saved in the session, and used for all subsequent FTP 
routines (including FTP_Login).

In fact, all FTP_Conn() does is call FTP_open() followed by FTP_login(). 
It's just a wrapper around those two procedures.


> The FTP_Conn works and returns a session, but FTP isn't configured on 
> the remote site (configured incorrectly). I ran into this when I was 
> debugging and fat fingered a server address. I don't know how much of a 
> problem this will be in real life, but wondered if there was a work 
> around.

Yes, I'd say it's an issue.  You never know when a network error will 
occur.  Someone might pull out the plug of your router or switch.  Or a 
cable might get cut.  Or a device might go bad.  And this doesn't have to 
be in your shop!  It could be on the FTP server side.  Or it could be at 
your ISP.  Or somewhere else on the Internet.

When you write programs that communicate between systems, you should 
always program defensively.  Always expect that something could fail at 
any time.

This was one of the main reasons I created FTPAPI in the first place -- 
it's too hard to detect and handle errors with IBM's "batch FTP" scripts. 
I needed more control in order to make my applications robust.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------