🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TIdTCPServer, writing to all clients (Indy + BCB6)

#2556
From: Remy Lebeau (TeamB)
Date: Sun, 26 Mar 2006 21:23
33 lines
1893 bytes
"Boris Epel" <boep777@yahoo.com> wrote in message
news:44250f70$1@newsgroups.borland.com...

> Therefore server has to be able to send messages to all clients. I did
> not realize how to do it using TIdTCPServer component (how to access
> Connection from outside of the threads).

Use the server's Threads property, ie:

    TList *List = IdTCPServer1->Threads->LockList();
    try
    {
        for(int x = 0; x < Threads->Count; ++x)
        {
            TIdPeerThread *Thread = (TIdPeerThread*) List->Items[x];
            // use Thread->Connection as needed ...
        }
    }
    __finally
    {
        IdTCPServer1->Threads->UnlockList();
    }

> is it legal(clever in my case) to use server threads only for reading from
> the socket and to perform writing in other thread (which will process
requests)?

That depends on what those threads are going to be doing in the first place.
Please provide more details.


Gambit
Technical Details
Message-ID: <4427065d$5@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44250f70$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,34e362c244f8763d
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: <44250f70$1@newsgroups.borland.com>
Subject: Re: TIdTCPServer, writing to all clients (Indy + BCB6)
Date: Sun, 26 Mar 2006 13:23:40 -0800
Lines: 35
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: <4427065d$5@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1143408221 68.69.17.41 (26 Mar 2006 13:23:41 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail