Solved

TClientSocket  Exceptions

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

776 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