> Is there a way to limit the cpu usage when receiving files thru TWsocket? 

> Usualy CPU is 90-100% used and the computer freezes for the time the transfer 
> is made.

If you write in a random sized chunks (especially byte-per-write), use
some kind of write-buffering filestream (AFAIR Arno has coded one). If that
won't help you much, insert 


*before* call to write/writefile/blockwrite/etc.

Inserting your code into separate thread won't help you if you're
experiencing *computer* (not program!) freezes. Also, don't use
dynamically-sized memory streams and memory buffers (like dynamic arrays,
note that long string is also a kind of dynamic array, and concatenating
strings is a kind of dynamic resize of an array), you won't get any
benefits, only trouble (like wasting time for memory reallocation and
having memory fragmented). If you need buffer, use static one (like
pre-allocated array).

Piotr "Hellrayzer" Dalek

Kliknij po wiecej! >>> http://link.interia.pl/f18ed

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

Reply via email to