Article View: borland.public.cppbuilder.internet.socket
Article #4268Re: Demos
From: Hans Galema
Date: Mon, 14 Mar 2005 12:51
Date: Mon, 14 Mar 2005 12:51
25 lines
2081 bytes
2081 bytes
Michele Santucci wrote: > anyway I fixed my problems rigth now but I noticed a strange behaviour... > I set up my ServerSocket to be stNonBlocking so when the client sends a > packet to my server the ClientRead event is fired. > Inside my OnClientRead event handler I start reading bytes of the message > using the ReceiveBuf socket method. You should alway read exactly the amount of bytes indicated by Socket->ReceiveLength(). If that gives 0 of < 0 then return. > Anything works here but if I call Application->ProcessMessages() somewhere > in my code before having completly unbuffered received data the OnClientRead > event is fired again... > That sounds pretty strange to me. What do you mean with "completly unbuffered" ? It is better not to call ProcessMessages with a non-blocking socket is my experience. It makes no sence too. If you received all bytes indicated by RecieveLength() and handled the data then the function ends and so the application can process messages without you having to tell to do so. Hans.
Technical Details
Message-ID:
<42358953$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4231cced@newsgroups.borland.com> <4231ded4@newsgroups.borland.com> <42358583$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ac22febc451b7e17 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 14 Mar 2005 13:51:46 +0100 From: Hans Galema <notused@notused.nl> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Demos References: <4231cced@newsgroups.borland.com> <4231ded4@newsgroups.borland.com> <42358583$1@newsgroups.borland.com> In-Reply-To: <42358583$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.201.248 Message-ID: <42358953$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1110804819 129.125.201.248 (14 Mar 2005 04:53:39 -0800) Lines: 25 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail