Solved

TClientSocket  Exceptions

Posted on 2001-06-04
3
156 Views
Last Modified: 2010-04-06
Hey everyone.  I'm working with a TClientSocket component.  Here's my problem:

var Connection: TClientSocket
----
...
try
  Connection.Open;
except
  on EAsyncSocketError do ShowMessage('Error.');
end;
...
---

This construction will not catch exceptions thrown by the Connection object.  Any ideas why?  Is this a documented thing?  Thanks for any help.

-Joe
0
Comment
Question by:jbanafato
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Cesario
Comment Utility
Hi jbanafato,

To catch the exception use the ClientSocketError Event :

procedure TForm1.ClientSocket1Error(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);
begin
  ErrorCode := 0;
  // If you dont set the ErrorCode to 0 so you got an      exception
end;

Best Regards

Cesario
0
 

Author Comment

by:jbanafato
Comment Utility
Excellent, exactly what I'm looking for.  That should fix my problem.  Thank you very much.

-Joe
0
 
LVL 8

Accepted Solution

by:
Cesario earned 50 total points
Comment Utility
have a nice day ;-)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

9 Experts available now in Live!

Get 1:1 Help Now