>> One possible explanation were that anytime OnDataAvailable returns,
>> just a few _new_ bytes are available in winsock buffer. Could be
>> possible due to the background thread winsock creates internally
>> with non-blocking sockets, though I'm not aware of how winsock works
>> under the hood.
> When in this situation, we got a few hundred calls a second, for an
> unlimited time, where normally it's one every few seconds.
> I agree with you, it could be a possible cause, but very unlikely.

Do you receive data each time you call ReceiveStr ? If yes, then probably 
you have a fast network, and your application becomes CPU bound.

btw: Since you don't use line mode, I strongly suggest you avoid ReceiveStr 
and instead use Receive with a fixed buffer. Calling ReceiveStr will force 
the runtime to create new string and copy data into it, and probably youthen 
copy data elsewhere for processing. All this is very CPU intensive.

The best way to design a high performance application is to use a fixed 
buffer (which may be dynamically allocated but not each time you receive 
data). And use the buffer as close as possible of the processing each time 
you copy data, each time you consume CPU and memory for nothing.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to