QFtp : Connexion to false IP doesn't expirate
Hi,
I'm trying to write a small program using QFtp, and I need to try to connect to several IP and ignore those who hasn't a valid ftp server. But it looks like the signal commandFinished isn't called like it is if you try to connect to an invalid web address. So how can I know that the connexion to the IP is failing and that I should try the next address?
(The FTP example from the documentation report an error when given a false address bug "freeze" when given 1.1.1.1)
I hope my english isn't too bad to be understandable...
Thanks
Re: QFtp : Connexion to false IP doesn't expirate
Process the states returned from QFtp, if you get "Connecting" state for too long, abort the connection and assume host doesn't exist.
2 Attachment(s)
Re: QFtp : Connexion to false IP doesn't expirate
I had the same problem. Needed to inform a user that some command (be it connecting or put, get etc.) takes too long. So I created a class that is set on QFtp pointer. I hope it is fine. It takes QFtp isntance pointer, which has to observe and when it's action is started - waits for specified time. If the state doesn't change within that time (suppose this is host looking or connecting) or the data transfer progress doesn't change - it emits timeout signal.
The first timeout (until the first command is executed) is a bit longer here - I assumed this one would take the most of time. Here, have a look at my code. If You see any mistakes, I am opened.
Caution: I didn't inherited from QFtp to have one TimeOutFtp class due to my specific reasons. But of course, this would be the good idea as well.
Hope it helps.
Regards,
Chris.