Menu

#12 Add TBlockSocket.SendChunkDelayMs (code attached)

Just_idea
open
Geby
5
2012-11-30
2012-11-30
Barry Staes
No

I use TBlockSock.SendMaxChunk and i also needed a way to insert a delay in between these chunks. (for debugging and reproducing problems with embedded hardware having limited resources)

Basically Sleep() is called after each chunk sent, if a nonzero value is assigned to TBlockSocket.SendChunkDelayMs

Code is attached in zip file, its a patch diff shown in html.
For brevity, all inserted code was:

* inserted TBlockSocket private var
FSendChunkDelayMs : Word; // 20121130 Barry.

* inserted TBlockSocket published property
{:All sent chunks are seperated by this delay if nonzero.}
property SendChunkDelayMs: Word read FSendChunkDelayMs Write FSendChunkDelayMs; // 20121130 Barry.

* inserted TBlockSocket.CreateAlternate line, below FSendMaxChunk := c64k;
FSendChunkDelayMs := 0; // 20121130 Barry.

* inserted TBlockSocket.SendBuffer line, below DoStatus(HR_WriteCount, IntToStr(r));
if (FSendChunkDelayMs > 0) then Sleep(FSendChunkDelayMs); // 20121130 Barry.

Discussion

  • Barry Staes

    Barry Staes - 2012-11-30
     
  • Barry Staes

    Barry Staes - 2013-02-27

    Serial ports when setup can be configured to send data in chunks and have a delay between each chunk. This is useful when communicating with chips with limited resources, or when there is no handshake.

    This feature allows the network port to send data in chunks, to match RS232 behavior.

    It may look like a quick hack because its using Sleep(), and it indeed was a quick hack.
    I do not know of a better approach to insert artificial delays between chunks though.
    If a change of implementation helps in getting this feature added to Synapse or you know of other improvements or issues with this feature: suggestions and comments welcome.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.