🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Send buffer from server to a client

#4493
From: Vin�cius
Date: Fri, 28 Jan 2005 12:12
53 lines
3284 bytes
Ok

    First thank's Remy and Hans

    I'm gonna try to explaim in details what I trying to do. The real two 
aplicantiion that i'm trying to do (Server/Client), talk's on two directions 
with messages (that buffers that I refer), and this messages is sent 
asynchronously at on time (that I don't know when), the server sends this 
message for the client, and the client must read that and process this 
message. And the client also send this messages asynchronously for the 
server, then the server must read this and process.

To simulate this, i make a small aplication to send buffers(string, that is 
a test). I simulate the asynchronously with buttons to send the messages, so 
I easily make this button for the client and write on the Indybuffer, to the 
server read them, the server read them inside the execute of the thread 
connection, but the opposite way, I don't know how to make a button (on the 
server) that when is clicked, write on the IndyBuffer, and the client read 
(In some methot or event) and process the message.~

It that yours sugestions can work

> This also exists, "AThread->Connection->WriteBuffer()", but only
> can be called inside the events of the server, or I wrong??

>You are wrong.  You can call WriteBuffer() at any time from anywhere you
>want.  All you need is a pointer to the Connection.  From outside the event
>handlers, you can use the server's ActiveThreads property to gain access to
>the Connections that are currently running.

I have to use the TIdPeerThread outside this events??? how can I do that??
what is "ActiveThreads property"?? I don't find this
I think that (if this work) will solves the side of server, on sending 
messages.

>If you want the client to receive data asynchronously, then you have to do
>the same thing that the server does - run a separate thread that
>continuously reads from the socket.  For example:

>    class TMyReadThread : public TThread
>    {
>    private:
>        TIdTCPConnection *FConn;
>    protected:
>        void __fastcall Execute();
>    public:
>        __fastcall TMyReadThread(TIdTCPConnection *AConn);
>    };

I think that will work!!, thanks a lott!!

thank's you two
Remy and Hans 
Technical Details
Message-ID: <41fa2c3c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41f90c54@newsgroups.borland.com> <41f93966$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2b30b06ce9be7f64
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Vin�cius" <vgalo2000@yahoo.com.br>
From: "Vin�cius" <vgalo2000@yahoo.com.br>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41f90c54@newsgroups.borland.com> <41f93966$1@newsgroups.borland.com>
Subject: Re: Send buffer from server to a client
Date: Fri, 28 Jan 2005 10:12:39 -0200
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 200.251.67.44
Message-ID: <41fa2c3c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1106914364 200.251.67.44 (28 Jan 2005 04:12:44 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail