Solved

Client/Server

Posted on 2002-05-04
2
138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Expert Comment

by:hagur
ID: 6990145
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
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);
begin
  ErrorCode :=0;
end;


Best Regards

Cesario
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

724 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