Re: Borland Socket Service
- From: Olivier Pons <olivier.dot.pons.at.gmaildot.com@xxxxxxxxxxxxxx>
- Date: Wed, 17 Oct 2007 09:42:28 +0200
Marco Caspers a écrit :
Olivier Pons wrote:
Then you are likely using it wrong to begin with. Indy can run forOkay.
a long time when used properly.
Here's the code sample with THTTPSend.
I did exactly the same with the Indy component.
Only the name of the functions changed.
I always had an access violation after say beween 10.000.000 and
25.000.000 of threads created. I've never had that with the synapse
component, after 7 days of running non-stop (1.250.000.000 threads).
procedure TThreadParse.Execute;
var
HTTP : THTTPSend;
begin
HTTP := THTTPSend.Create;
try
HTTP.Clear;
HTTP.HTTPMethod('GET', 'http://localhost:/');
finally
HTTP.Free;
end;
end;
So you leave the exception dangling without handling it anywhere else?
Cause that's what you do there. Finally only assures that your call to
Free runs, but the exception still exists and will rear it's ugly head
giving you very weird exceptions in very weird places where they can't
actually occur at all.
In my opinion you shouldn't put that code in execute.
You need to put that in another method, and call it from execute like
this:
try
TheOtherMethod;
Except
handle the exception;
end;
This way if anything goes wrong and causes an exception in
TheOtherMethod, you've handled that exception in an apropriate way,
making certain that the exception isn't dangling and caught somewhere
else giving you "wrong information" in the "wrong place".
That's something I did (maybe I didn't express myself properly) :
procedure TThreadParse.Execute;
var
HTTP : THTTPSend;
begin
HTTP := THTTPSend.Create;
try
try
HTTP.Clear;
HTTP.HTTPMethod('GET', 'http://localhost:/');
finally
HTTP.Free;
end;
except
end;
end;
This gave me the same results.
I don't know how Indy works, but this is not simple enough for me and I don't know how comes it's so complex to accomplish some easy tasks.
I do insist : when you look at the synapse components, the code is nice and clear as water. That's not the case (far from it) with Indy comps.
To me simplicity is the heart of good programming.
Regards,
Olivier Pons
.
- Follow-Ups:
- Re: Borland Socket Service
- From: Brad White
- Re: Borland Socket Service
- References:
- Borland Socket Service
- From: Vassilis D
- Re: Borland Socket Service
- From: Marco Caspers
- Re: Borland Socket Service
- From: GrandmasterB
- Re: Borland Socket Service
- From: Marco Caspers
- Re: Borland Socket Service
- From: Olivier Pons
- Re: Borland Socket Service
- From: Remy Lebeau \(TeamB\)
- Re: Borland Socket Service
- From: Olivier Pons
- Re: Borland Socket Service
- From: Marco Caspers
- Borland Socket Service
- Prev by Date: Re: CrossKylix discontinued
- Next by Date: Re: CrossKylix discontinued
- Previous by thread: Re: Borland Socket Service
- Next by thread: Re: Borland Socket Service
- Index(es):
Relevant Pages
|