🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages Started by Thomas Blankschein Tue, 10 Oct 2006 15:39
TidFTP: Timeout and error translation?
#1840
Author: Thomas Blankschein
Date: Tue, 10 Oct 2006 15:39
27 lines
2083 bytes
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?
#1843
Author: Remy Lebeau (TeamB)
Date: Tue, 10 Oct 2006 17:53
30 lines
1979 bytes
"Thomas Blankschein" <thomas@blankschein.de> wrote in message
news:452bbea0@newsgroups.borland.com...

> 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.

> How can I implement a timeout functionality?

Indy 8 did not support that.  You will have to upgrade to Indy 9 for that.

> 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().

> Is there a list of error codes?

You have to look in the WinSock API documentation.


Gambit
Re: TidFTP: Timeout and error translation?
#1857
Author: Thomas Blankschein
Date: Thu, 12 Oct 2006 18:05
14 lines
1395 bytes
Hi Gambit,


> 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.

> The VCL has a SysErrorMessage() function that wraps FormatMessage().

Thanks, that's what I need.


Thomas
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads