Article View: borland.public.cppbuilder.internet.socket
Article #2974Re: Reading data from TServerSocket in TClientSocket
From: Bob Gonder
Date: Sun, 01 Jan 2006 07:22
Date: Sun, 01 Jan 2006 07:22
32 lines
2200 bytes
2200 bytes
Maurice Anderson wrote:
>while (!Terminated && ClientSocket->Connected)
>{
> if (pStream->WaitForData(6000))
> {
> ReadPacket(pStream);
> Synchronize(DoStuffOnMainForm);
I don't know why you would want to do that with DoStuffOnMainForm
since it doesn't seem to do stuff with the main form?
>void __fastcall TMyServerThread::DoStuffOnMainForm(void)
>{
> AnsiString FileName = "Hello World";
> Strm2 = new TMemoryStream;
> Strm2->Clear();
> BinaryTransfer1->SendTextMessage(Strm2, FileName);
> ClientSocket->SendBuf(Strm2->Memory, Strm2->Size);
>}
>> >(2) Is ClientSocket->OnRead executed in a seperate thread?
>>
>> Yes, usually.
>
>Are you saying that there are times that ClientSocket->OnRead will execute
>in the main thread? If so what would cause it to alternate between
>executing in a seperate thread and executing in the main thread?
It is just a function, after all. Anyone can call it. Usually you
don't call it, and let it operate as intended.
Technical Details
Message-ID:
<qa0fr15mlq9f855jqhndh9enmfa6auo27b@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43b72c70$1@newsgroups.borland.com> <thjer1h3bk668mqjsldbil598c69mo46po@4ax.com> <43b753c8$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,eeddadf8c21d2f02 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Reading data from TServerSocket in TClientSocket Date: Sat, 31 Dec 2005 23:22:22 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <qa0fr15mlq9f855jqhndh9enmfa6auo27b@4ax.com> References: <43b72c70$1@newsgroups.borland.com> <thjer1h3bk668mqjsldbil598c69mo46po@4ax.com> <43b753c8$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.69.81.148 X-Trace: newsgroups.borland.com 1136100021 69.69.81.148 (31 Dec 2005 23:20:21 -0700) Lines: 34 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail