🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Would Indy's TIdTCPServer have any problem with connections I never read from?

#2061
From: Remy Lebeau (TeamB)
Date: Wed, 30 Aug 2006 21:41
47 lines
2925 bytes
"Lesley Anne" <mspfila-ng@yahoo.com> wrote in message
news:44f5ef4f@newsgroups.borland.com...

> > Why just just read inside the server's OnExecute event?
> > It is triggered on a per-connection basis.
>
> When is that triggered?

Immediately after the OnConnect event exits, OnExecute is triggered in a
continuous loop for the lifetime of the connection.

> It sounded from the help file as though it were triggered when
> a new thread is started

A new thread is created when a client connects to the server, yes.
OnConnect is triggered first, then OnExecute in a loop until the socket is
closed, and then OnDisconnect is triggered.

> which I assume would be only when a connection is first made.

You assume incorrectly.  That is not what the help file says.

> Is it triggered again after that?

Yes.  It is the main processing event for the thread.  It is triggered in a
continuous loop while the thread is running.

> the OnExecute event handler itself is in whichever thread the
> TIdTCPServer component is in (the main application thread if
> the server is on the form), rather than inside the individual thread
> that it references

It does not matter what class the OnExecute event handler is DECLARED in.
The OnExecute event handler (and any other event handler that provides
access to the connection's thread/context) is TRIGGERED in the context of
the worker thread that is managing the connection.  It is NOT triggered in
the context of the thread that owns the TIdTCPServer.

> how do you keep one connection from blocking all others

By being multi-threaded, TIdTCPServer already does exactly that for you.
Just read inside the OnExecute event, and only that one connection will be
blocked.  The other connections will trigger their own events separately.


Gambit
Technical Details
Message-ID: <44f6068c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44f480ff@newsgroups.borland.com> <44f49d01$1@newsgroups.borland.com> <44f5c67a$1@newsgroups.borland.com> <44f5e682$1@newsgroups.borland.com> <44f5ef4f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,c51ec25c5d4e68e1
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <44f480ff@newsgroups.borland.com> <44f49d01$1@newsgroups.borland.com> <44f5c67a$1@newsgroups.borland.com> <44f5e682$1@newsgroups.borland.com> <44f5ef4f@newsgroups.borland.com>
Subject: Re: Would Indy's TIdTCPServer have any problem with connections I never read from?
Date: Wed, 30 Aug 2006 14:41:46 -0700
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44f6068c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1156974220 68.69.17.41 (30 Aug 2006 14:43:40 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail