how to set delay in a Loop

Discussion in 'Mac Programming' started by smogsy, Oct 8, 2008.

  1. smogsy macrumors 6502a

    Jan 8, 2008
    heres my Code it works correctly for what i want to do, but i want to Delay The loop for 10 seconds each time so it say Sent To IP (delay 10 second) Sent To IP (delay 10 sec) and so on...

    hope you can help

  2. mufflon macrumors 6502

    Sep 15, 2006
    I would advice on using sleep(10000) (e.g. milliseconds), it works in java and it seems to be implemented for c as well

    a page which implies that it exists

    Alternatively google for "C sleep"

    edit: might be seconds, checkout

    here instead
  3. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    You can use the select function to pause with finer granularity, but in this case sleep should be fine. As an aside, sleep guarantees a pause for AT LEAST the time you specify, but it can be longer. It generally isn't too much longer, but you can't depend on it to return after exactly 10 seconds, etc.


Share This Page