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

Reply via email to