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

Re: [FTPAPI] Reply message from ftp_put



Luciano,

Scott may have a better idea, but for your requirements, I think the
best solution would be to modify the source of FTPAPI so that the
success message is as available as the error message.  The ability to
modify the source is one of the benefits of open source after all.

If you choose to go that route, you might consider getting the
re-factored version of FTPAPI from Dennis or Scott that's discussed in
this thread:
http://www.scottklement.com/archives/ftpapi/201012/msg00063.html

HTH,
Charles

On Tue, Dec 14, 2010 at 4:00 AM, Luciano Vigna <luciano.vigna@xxxxxxxxx> wrote:
> 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
> -----------------------------------------------------------------------
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------