🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: stThreadBlocking Vs stNonBlocking confusion

#4512
From: Stefano Bonifazi
Date: Wed, 02 Feb 2005 10:06
57 lines
3147 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:41ffd228$1@newsgroups.borland.com...
>

Thanks Remy once more time! :-)

>> - with non-blocking the server socket can receive simultaneously
>> from many clients
>
> The server can do that regardless of blocking or non-blocking.
>

Good!

> Yes.  However, the data in the socket is already buffered in memory by the
> time the OnClientRead event is triggered.  You can query how many data is
> actually available via ReceiveLength() and then perform a single read to
> copy the entire buffer into your application's own buffers in a single
> operation very quickly.  If your processing of the data is simple, the 
> event
> handler will exit relatively quickly, and other sockets can then be 
> serviced
> just as quickly.  If, on the other hand, your processing of the data can 
> be
> time-consuming, then you should copy the data to a different thread so 
> that
> the event handler can exit as soon as possible.

Great! That's music for my ears!

> A thread that is reading from a blocking socket doesn't need to do 
> anything
> else while it is reading, so blocking the thread is fine.

Fine! So I guess that in non blocking mode Borland or Microsoft have their 
"threads" setting " while receiving from the different clients!

>> I should be able to have a non-blocking Client and a ThreadBlocking 
>> server
>
> Correct.
>
GOOOD New!!

>> The problem is that with the simple test I'm posting in this thread right
>> now the Threadblocking server does nothing with my simple non-blocking
>> client...
>
> You are probably not using it correctly.

OK but the main problem is that even if I searched all google as You 
suggested I only could find examples of Threadblocking ServerSocket using 
the user made Threads with TWinSocketStream, nothing using the common 
OnClientRead event! :(

Thanks again Gambit! Have You never thought to take a University seat? I 
would pay gold to have such a teacher!:) 
Technical Details
Message-ID: <4200a62f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41fe906e@newsgroups.borland.com> <41fe99bf$1@newsgroups.borland.com> <41ff64b9@newsgroups.borland.com> <41ff691e$1@newsgroups.borland.com> <41ffb890@newsgroups.borland.com> <41ffd228$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4f7607071b9a8537
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Stefano Bonifazi" <stefboombastic@email.it>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41fe906e@newsgroups.borland.com> <41fe99bf$1@newsgroups.borland.com> <41ff64b9@newsgroups.borland.com> <41ff691e$1@newsgroups.borland.com> <41ffb890@newsgroups.borland.com> <41ffd228$1@newsgroups.borland.com>
Subject: Re: stThreadBlocking Vs stNonBlocking confusion
Date: Wed, 2 Feb 2005 11:06:41 +0100
Lines: 59
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: 212.141.203.34
Message-ID: <4200a62f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1107338799 212.141.203.34 (2 Feb 2005 02:06:39 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail