🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #577

Re: Using TIdTCPServer

#577
From: Peter
Date: Mon, 28 Jan 2008 20:11
58 lines
3126 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"Peter" <piotrtrzeciak@yahoo.com> wrote in message 
>news:479e2c75$1@newsgroups.borland.com...
>
>> The main server (TIdTCPServer) component is part of the TService
>> application, and in it's main Execute thread, it is started like this:
><snip>
>
>Get rid of that OnExecute handler altogether.  TService already runs such a 
>loop internally for you when no OnExecute handler is assigned.  Instead, 
>activate the server in the OnStart event, and deactivate it in the service's 
>OnStop/Shutdown events, ie:
>
>    void __fastcall TMyService::ServiceStart(TObject *Sender, bool &Started)
>    {
>        iln_rcv_socket->Active = true;
>        Started = true;
>    }
>
>    void __fastcall TMyService::ServiceStop(TObject *Sender, bool &Stopped)
>    {
>        ServiceShutdown(Sender);
>        Stopped = true;
>    }
>
>    void __fastcall TMyService::ServiceShutdown(TObject *Sender)
>    {
>        iln_rcv_socket->Active = false;
>    }
>
>
>> This seems to be working ok, however, it appears that I can only
>> get the first connection to come in ok, and the rest after that fail.
>
>TIdTCPServer works fine in a service environment.  If you are having 
>problems with connections, then your TIdTCPServer event handler code is 
>likely buggy to begin with.
>
>> I also added TIdAntiFreeze component to the TService application
>
>TIdAntiFreeze is useless in a service.  It operates only in the context of 
>the main thread, and acts as a no-op in worker threads.  TService does not 
>run in the main thread.
>
>> Also, I assume that all storage in OnExecute handler of the TIdTCPServer
>> is local to the each thread.
>
>What "storage" are you referring to exactly?
>
>
>Gambit 
>
>

Thanks!!! This is great! It's the lack of documentation that's driving me nuts :-) but I'm chugging along. I have a few other "variables" in the picture (like a third-party imaging libs), so anything is possible as far as "bugs" go.
I have lots of info to go on for now. Thanks again!
Technical Details
Message-ID: <479e450b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <478e1c34$1@newsgroups.borland.com> <478e4760@newsgroups.borland.com> <4798a5e1$1@newsgroups.borland.com> <4798cf30$1@newsgroups.borland.com> <4798db8f$1@newsgroups.borland.com> <4798ef34$2@newsgroups.borland.com> <479e2c75$1@newsgroups.borland.com> <479e382e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,452e664b18b0b56c
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Peter" <piotrtrzeciak@yahoo.com>
Sender: "Peter" <piotrtrzeciak@yahoo.com>
Reply-To: "Peter" <piotrtrzeciak@yahoo.com>
Subject: Re: Using TIdTCPServer
Newsgroups: borland.public.cppbuilder.internet.socket
X-User-Info: 207.45.45.41     
References: <478e1c34$1@newsgroups.borland.com> <478e4760@newsgroups.borland.com> <4798a5e1$1@newsgroups.borland.com> <4798cf30$1@newsgroups.borland.com> <4798db8f$1@newsgroups.borland.com> <4798ef34$2@newsgroups.borland.com> <479e2c75$1@newsgroups.borland.com> <479e382e$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <479e450b@newsgroups.borland.com>
Date: 28 Jan 2008 13:11:39 -0700
X-Trace: newsgroups.borland.com 1201554699 207.105.83.66 (28 Jan 2008 13:11:39 -0700)
Lines: 58
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail