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

R: [FTPAPI] Reply message from ftp_put



Hi Scott,

your words are very clear, but my exposition isn't complete; indeed, sorry,
I miss to explain that we need to know the message 226 because the FTP
server return a line like this:

226 JOB = TW00177920 Transfer complete...

And we'll use the job number for next steps (i.e.: retrieve a report file
named like job number release from FTP server, or write a log file for send
history and update another file...etc)

Now the problem is completely explained, thank you

Luciano




-----Messaggio originale-----
Da: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Per conto di Scott Klement
Inviato: lunedì 13 dicembre 2010 19:30
A: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Oggetto: Re: [FTPAPI] Reply message from ftp_put

Hello Luciano,

The ftp_put() routine is designed to make it easy to handle errors. 
ftp_put() will return 0 if it was able to successfully transfer the 
file, or -1 if any error occurred.

You don't need to look at the underlying FTP protocol message (like 
226), you can simply check the return value.

Example:

      rc = ftp_put(session: tofile: fromfile );
      if (rc = 0);
         // success!
      else;
         error_msg = ftp_errorMsg(session);
      endif;

Or even easier:

      if ftp_put(session: tofile: fromfile ) <> 0;
         error_msg = ftp_errorMsg(session);
      endif;

It only returns 0 if the file transfer was successful.  If you get a 0, 
it means it was transferred.  No need to parse/understand the raw FTP 
protocol data.  It does the work for you.


On 12/13/2010 8:49 AM, Luciano Vigna wrote:
>
> How can retrieve the message response from the ftp_put command?
> (i.e. "226 File upload OK" or any error message), we need to know if
> the file was upload correctly or not.
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------