🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Using TIdTCPServer

#580
From: Peter
Date: Tue, 29 Jan 2008 14:37
62 lines
3388 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 
>
>

Just two quick questions:
1. By "storage", I mean, variables declared in the OnExecute handler, which is a method of the TService class (when the TIdTCPServer is added to the service form, that's how it gets declared). I assume all variables there are "thread-safe".
2. I see some posts about "broken" Indy libraries in Borland C++ Builder 2007.
My version says: 10.0.0.17. Is it ok? Should I upgrade?

Thanks again!!!
Technical Details
Message-ID: <479f4835$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!feeder.ecngs.de!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!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: <479f4835$1@newsgroups.borland.com>
Date: 29 Jan 2008 07:37:25 -0700
X-Trace: newsgroups.borland.com 1201621045 207.105.83.66 (29 Jan 2008 07:37:25 -0700)
Lines: 62
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!feeder.ecngs.de!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail