Solved

TClientSocket  Exceptions

Posted on 2001-06-04
3
157 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
ID: 6153053
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
ID: 6153076
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
ID: 6153086
have a nice day ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 263
Delphi : could not find program, '...exe' 2 148
oracle global variables 4 63
Tembedded WB animatid gifs not animated on some pcs 2 73
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

13 Experts available now in Live!

Get 1:1 Help Now