Board index » cppbuilder » TidFTP: Timeout and error translation?

TidFTP: Timeout and error translation?


2006-10-10 11:39:12 PM
cppbuilder89
Hello,
I use BCB5 with Indy 8.0.22.
I want to implement a simple FTP client into my application to up- and
download files from and to an inhouse ftp-server.
I use the TidFTP component and I like the idea of blocking mode. This
prevents me from building something like a state machine.
But I have two problems:
1. How can I implement a timeout functionality? I tested the TidFTP
component on my home pc with software firewall. If I don't answer the
"Allow or reject internet connection"-dialog of the firewall software,
my testprogram waits forever. In real life, if something is blocking the
connection, I want to wait a number of seconds and then inform the user
about the problem.
2. Several different exceptions are thrown, if something went wrong. For
example, if I try to connect to a server which does not exist, I get an
EidSocketError 'Socket Error # 11004'. This is not a very user-friendly
information. Is there a way to translate the messages to a more friendly
text like 'Server does not exist'? Is there a list of error codes?
Thanks,
Thomas
 
 

Re:TidFTP: Timeout and error translation?

"Thomas Blankschein" < XXXX@XXXXX.COM >wrote in message
Quote
I use BCB5 with Indy 8.0.22.
That is a very old version of Indy that is no longer supported. You should
seriously consider upgrading.
Quote
How can I implement a timeout functionality?
Indy 8 did not support that. You will have to upgrade to Indy 9 for that.
Quote
Several different exceptions are thrown, if something went wrong. For
example, if I try to connect to a server which does not exist, I get an
EidSocketError 'Socket Error # 11004'. This is not a very user-friendly
information. Is there a way to translate the messages to a more friendly
text like 'Server does not exist'?
WinSock error codes can be passed to the Win32 API FormatMessage() function.
The VCL has a SysErrorMessage() function that wraps FormatMessage().
EIdSocketError has a LastError property that you can pass to
FormatMessage/SysErrorMessage().
Quote
Is there a list of error codes?
You have to look in the WinSock API documentation.
Gambit
 

Re:TidFTP: Timeout and error translation?

Hi Gambit,
Quote
That is a very old version of Indy that is no longer supported. You should
seriously consider upgrading.
Same with our BCB5. Things are unsure at the moment.
Quote
The VCL has a SysErrorMessage() function that wraps FormatMessage().
Thanks, that's what I need.
Thomas
 

{smallsort}