Solved

TClientSocket  Exceptions

Posted on 2001-06-04
3
161 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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