[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

program to wait 5 secs?

Posted on 1999-11-30
2
Medium Priority
?
336 Views
Last Modified: 2013-11-20
I'm writing a function to send 3 udp packets at 5 second intervals.  I've written a class to send a packet, but dont know how to get my function (which is running in a thread) to halt for 5 secs....

can anyong help?

void nyFunc()
{
  for (int i = 0; i < 3; i++) {
    // send udp packet

    // wait 5 seconds
  }
}

Moth
0
Comment
Question by:Moth
2 Comments
 
LVL 1

Accepted Solution

by:
TheMadManiac earned 200 total points
ID: 2243519
you can just call Sleep(milisecs)

Sleep(5000);

this would wait 5 seconds. You need to include windows.h, but you probably already have.

Floris
0
 
LVL 1

Author Comment

by:Moth
ID: 2243546
Great! - That's just what I'm looking for...

Moth
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question