Re: Borland Socket Service



Marco Caspers a écrit :
Olivier Pons wrote:

Then you are likely using it wrong to begin with. Indy can run for
a long time when used properly.
Okay.
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
.



Relevant Pages

  • Re: Borland Socket Service
    ... Here's the code sample with THTTPSend. ... I did *exactly* the same with the Indy component. ... I event tried to catch the exception in a try-except instead of try-finally but the exception seems to appear outside this thread, which, I admit, is not normal at all. ... I've spent so many nights trying to get it work, trying Indy Fibers and trying my own WSA stuff, that when I say Indy is not stable for threaded application, I've never found a way to make Indy components works that long, and when I saw how easy and how stable the synapse components were, it really got me angry. ...
    (borland.public.delphi.non-technical)
  • Re: WebException mit Code 513
    ... > würde in der Exception wohl auch ein Timeout erwähnt werden). ... "513" ist aber offenbar kein HTTP Statuscode. ... Prev by Date: ... Next by Date: ...
    (microsoft.public.de.german.entwickler.dotnet.framework)
  • This collection already contains an address with scheme http
    ... I get this error when I navigate to a web page hosting a WCF service: ... '/services/myservice.svc' cannot be activated due to an exception during ... address with scheme http. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: According to ESPN "Toyota Leaving IRL"
    ... > With the exception of Indy, ... He had it all, had his shot ... The Kool-Aid has finally started wearing off the hardcores. ...
    (rec.autos.sport.indy)
  • Re: FTP components?
    ... >> exception saying 'Already connected'. ... > If I call Connect in my program and I am in some incorrect state when ... choice the Indy designers have done. ... average VCL user. ...
    (borland.public.delphi.thirdpartytools.general)