Posted on 2002-05-04
Last Modified: 2010-04-04
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.
Question by:tyfing

Expert Comment

ID: 6990145
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.

Accepted Solution

Cesario earned 50 total points
ID: 6990201
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


Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
FMX enumerated colours 2 101
Dev express lookupcombo 3 28
Breakpoint doesn't stop in my variable 3 28
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question