[twsocket] twsocket cpu usage

2006-03-16 Thread [EMAIL PROTECTED]


Hello

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.

Radu



___
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com


-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Dod
Hello,

I think you have a problem because it should not eat 100% CPU nor
freeze your system.

regards.

imc Hello

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

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

imc Radu



imc ___
imc No banners. No pop-ups. No kidding.
imc Make My Way  your home on the Web - http://www.myway.com

-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Francois Piette
 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.

TWSocket component doesn't use much of the CPU. It is likely that in your 
application you've done
some wait loop which eat all CPU.

Can you show the part of your code which receive a file ?

--
Contribute to the SSL Effort. Visit
http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Wilfried Mestdagh
Hello Radu,

It is also possible if you send / receive very mutch data at high speed
and save to disk or so. This take some time and meanwhile next chunck is
probably already received.

If this is the reason then you can slow down the sending a little by
waiting a littel between data chuncks. You can do this using a timer for
example.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Thursday, March 16, 2006, 13:50, [EMAIL PROTECTED] wrote:



 Hello

 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.

 Radu



 ___
 No banners. No pop-ups. No kidding.
 Make My Way  your home on the Web - http://www.myway.com



-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Fastream Technologies
I think he is using sync methods which consume a fake 100% CPU. I 
experienced the same with TFtpServer 5 years ago before I switched to async. 
the reason is the default message pump of ICS uses PeekMessage whereas my 
suggestion is to build a message pump with GetMessage.

Best Regards,

SubZ

- Original Message - 
From: Francois Piette [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Thursday, March 16, 2006 3:46 PM
Subject: Re: [twsocket] twsocket cpu usage


 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.

 TWSocket component doesn't use much of the CPU. It is likely that in your 
 application you've done
 some wait loop which eat all CPU.

 Can you show the part of your code which receive a file ?

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 Author of ICS (Internet Component Suite, freeware)
 Author of MidWare (Multi-tier framework, freeware)
 http://www.overbyte.be


 -- 
 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 

-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread [EMAIL PROTECTED]

Indeed the data transfered is continously transfered at high speed and it is 
written directly to disk. 
Which is the best method I could use to slow cpu usage?
- make a timer and send data whith interrupts (but how to make a timer whith 
0.2 seconds step for example?)
- find somehow a component that limits bandwidth so that data to be forced to 
be send in slower motion 
- other method 

Radu




 --- On Thu 03/16, Wilfried Mestdagh  [EMAIL PROTECTED]  wrote:
From: Wilfried Mestdagh [mailto: [EMAIL PROTECTED]
To: twsocket@elists.org
Date: Thu, 16 Mar 2006 14:55:13 +0100
Subject: Re: [twsocket] twsocket cpu usage

Hello Radu,It is also possible if you send / receive very mutch data at high 
speedand save to disk or so. This take some time and meanwhile next chunck 
isprobably already received.If this is the reason then you can slow down the 
sending a little bywaiting a littel between data chuncks. You can do this using 
a timer forexample.---Rgds, Wilfried 
[TeamICS]http://www.overbyte.be/eng/overbyte/teamics.htmlhttp://www.mestdagh.bizThursday,
 March 16, 2006, 13:50, [EMAIL PROTECTED] wrote: Hello 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. Radu 
___ No banners. No pop-ups. No 
kidding. Make My Way  your home on the Web - http://www.myway.com-- To 
unsubscribe or change your settings for TWSocket mailing listplease goto 
http://www.elists.org/mailman/listinfo/twsocketVisit our website at 
http://www.overbyte.be

___
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com


-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Guillaume MAISON
 Indeed the data transfered is continously transfered at high speed and it is 
 written directly to disk. 
 Which is the best method I could use to slow cpu usage?
 - make a timer and send data whith interrupts (but how to make a timer whith 
 0.2 seconds step for example?)
 - find somehow a component that limits bandwidth so that data to be forced to 
 be send in slower motion 
 - other method 
 

each time you receive data, you store it in a growing buffer (TMemoryStream for 
example).
When you have reached a certain size (may be configurable), you create a 
thread, you transmit the TMemoryStream to the thread,
and the thread is in charge of writing the data on disk.

You'll have to manage some shared access to the disk (if you write the data in 
one file).

HTH,

-- 

Guillaume MAISON - [EMAIL PROTECTED]
83, Cours Victor Hugo
47000 AGEN
Tél : 05 53 87 91 48 - Fax : 05 53 68 73 50
e-mail : [EMAIL PROTECTED] - Web : http://nauteus.com

-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Dod
Hello iwsc,

I don't think you'll bootleneck your hard drive with network data
transfert, unless you get many at same time on a Gigabyte LAN ?

imc Indeed the data transfered is continously transfered at high speed and it 
is written directly to disk. 
imc Which is the best method I could use to slow cpu usage?
imc - make a timer and send data whith interrupts (but how to make a timer 
whith 0.2 seconds step for example?)
imc - find somehow a component that limits bandwidth so that data to be forced 
to be send in slower motion 
imc - other method 

imc Radu




imc  --- On Thu 03/16, Wilfried Mestdagh  [EMAIL PROTECTED]  wrote:
imc From: Wilfried Mestdagh [mailto: [EMAIL PROTECTED]
imc To: twsocket@elists.org
imc Date: Thu, 16 Mar 2006 14:55:13 +0100
imc Subject: Re: [twsocket] twsocket cpu usage

imc Hello Radu,It is also possible if you send / receive very mutch data at 
high speedand save to disk or so. This take some time and meanwhile next chunck 
isprobably already received.If this is the
imc reason then you can slow down the sending a little bywaiting a littel 
between data chuncks. You can do this using a timer forexample.---Rgds, Wilfried
imc 
[TeamICS]http://www.overbyte.be/eng/overbyte/teamics.htmlhttp://www.mestdagh.bizThursday,
 March 16, 2006, 13:50, [EMAIL PROTECTED] wrote: Hello Is there a way to 
limit the cpu usage when
imc receiving files thru TWsocket? Usualy CPU is 90-100% used and the 
computer freezes for the time the transfer is made. Radu 
___ No banners. No
imc pop-ups. No kidding. Make My Way  your home on the Web - 
http://www.myway.com-- To unsubscribe or change your settings for TWSocket 
mailing listplease goto
imc http://www.elists.org/mailman/listinfo/twsocketVisit our website at 
http://www.overbyte.be

imc ___
imc No banners. No pop-ups. No kidding.
imc Make My Way  your home on the Web - http://www.myway.com

-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Wilfried Mestdagh
Or throttle the sending of the data in the sender application. Now you
have probably something like this:

  Socket.Send(DataChunck, Len);

in SocketDataSent:
  SendNext;

in SendNext:
  // read next chunck from file
  Socket.Send(DataChunck, Len);

== you can change thsi as follow ==
  Socket.Send(DataChunck, Len);

in SocketDataSent:
  with TTimer.Create(Self) do begin
interval := 200;
enabled := True;
OnTimer := SendNextChunckTimerTimer;
  end;

in SendNextChunckTimerTimer:
  Sender.Free;
  SendNext;

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Thursday, March 16, 2006, 15:15, Guillaume MAISON wrote:

 Indeed the data transfered is continously transfered at high
 speed and it is written directly to disk. 
 Which is the best method I could use to slow cpu usage?
 - make a timer and send data whith interrupts (but how to make a
 timer whith 0.2 seconds step for example?)
 - find somehow a component that limits bandwidth so that data to
 be forced to be send in slower motion 
 - other method 
 

 each time you receive data, you store it in a growing buffer (TMemoryStream 
 for example).
 When you have reached a certain size (may be configurable), you
 create a thread, you transmit the TMemoryStream to the thread,
 and the thread is in charge of writing the data on disk.

 You'll have to manage some shared access to the disk (if you write the data 
 in one file).

 HTH,

 -- 

 Guillaume MAISON - [EMAIL PROTECTED]
 83, Cours Victor Hugo
 47000 AGEN
 Tél : 05 53 87 91 48 - Fax : 05 53 68 73 50
 e-mail : [EMAIL PROTECTED] - Web : http://nauteus.com


-- 
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


Re: [twsocket] twsocket cpu usage

2006-03-16 Thread Piotr Dałek
Hello!

 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 

sleep(0);

*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
[EMAIL PROTECTED]

--
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