I need to connect to a server from a client but if the client is unable to connect to the server because the server is offline I want it to display a message saying that there was a error connecting to the server.
The code I have tried is:
try
form1.IdTCPClient1.Host := 'localhost';
form1.IdTCPClient1.Port := 55555;
form1.IdTCPClient1.Connect;
except
ShowMessage('Connection Unsuccessful');
end;
But when I run the program it still gives me socket error #10061 error message.
Thank you for your help.