Thread: Put A Delay To A Buffer

  1. #1
    Registered User
    Join Date
    Apr 2005

    Exclamation Put A Delay To A Buffer

    Hey all,

    I have a question about adding a delay into a buffer that I use to communicate between to serial ports on a Linux system.

    When serial port 1 receives data, it has to sent it to a buffer and this buffer has to sent the data further to the second serial port.

    Now I want to add a delay to the buffer output. So when the buffer gets data it has to keep it there for, lets say 500 miliseconds and then sent it to port two.

    Can someone give me an explanation about the things I have to do, to create this delay?

    Thanks for your support.


  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    So do you want everything you get in the buffer to always be delayed? If so, just sleep for a half a second before you send. The FAQ covers sleeping. Or, if you're using some of the unix socket functions such as select, just use it to do the sleep for you. (man page)

    Hope is the first step on the road to disappointment.

  3. #3
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Cross [Posted.

    Closed. Further cross posts will result in deletion.

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

Popular pages Recent additions subscribe to a feed

Similar Threads

    By HowardL in forum Windows Programming
    Replies: 0
    Last Post: 09-11-2007, 03:16 PM
  2. Confused about fgets, clearing the buffer, etc
    By caduardo21 in forum C Programming
    Replies: 1
    Last Post: 06-13-2005, 11:03 AM
  3. Help with threading
    By crazeinc in forum C Programming
    Replies: 2
    Last Post: 06-02-2005, 05:23 PM
  4. Question on buffer overflows
    By maxhavoc in forum C++ Programming
    Replies: 3
    Last Post: 11-25-2004, 03:48 PM
  5. getline problem
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 10-06-2001, 09:28 AM