Solved

Client/Server

Posted on 2002-05-04
2
131 Views
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.
0
Comment
Question by:tyfing
2 Comments
 
LVL 3

Expert Comment

by:hagur
Comment Utility
You could try using the Try ... Except statement.

Example:

Try
  //Attempt to connect
Except
  //Display a message if you like, or do nothing ...
End;


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.
0
 
LVL 8

Accepted Solution

by:
Cesario earned 50 total points
Comment Utility
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);
begin
  ErrorCode :=0;
end;


Best Regards

Cesario
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now