On my program I'm actually using this code:
if IdFTP1.Connect = True then
begin
//makes some stuff
end
else
begin
ShowMessage('you got the move like jagger.');
end;
If I am not connected I see an error like
Socket Error #11001
Host not found
To avoid this, I thought that I could use the code you see above but I am having an error when I use IdFTP1.Connect = True
.
What could I do?
Connect()
does not return a Boolean if it fails. It raises an exception instead:
try
IdFTP1.Connect;
try
//makes some stuff
finally
IdFTP1.Disconnect;
end;
except
ShowMessage('you got the move like jagger.');
end;