when my client programme attempts to connect to the server which is currently not online as the PC is not switched on, an error occurs. my question is how do i stop any error messages from popping up should my client attempts to connect to the server, which at that point of time, is currently offline.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You could try using the Try ... Except statement.


  //Attempt to connect
  //Display a message if you like, or do nothing ...

Although an error message will be displayed when running the program through the Delphi IDE, this should work when you try to run the application from windows, (not through Delphi.)

You should also look into the onError events, if you are using the Client/Server components that are included with Delphi.
If you are using TClientSocket just add the OnError Event and set the ErrorCode to 0

procedure TForm1.ClientSocket1Error(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);
  ErrorCode :=0;

Best Regards


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.