Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Insert a Delay over ethernet

Insert a Delay over ethernet

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NewHSKid
    wrote on last edited by
    #1

    Hi, Still working on the program that sends messages over the internet. ;P The problem that I am facing now is inserting a delay. I need to insert a delay between sending numbers when i read from a file. The file just contains a bunch of numbers, each on their own line. I need to just put some delay that the user will set in another dialog box. Any ideas on how this is possible? Please help if you have any information. Thanks for your help. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    J 1 Reply Last reply
    0
    • N NewHSKid

      Hi, Still working on the program that sends messages over the internet. ;P The problem that I am facing now is inserting a delay. I need to insert a delay between sending numbers when i read from a file. The file just contains a bunch of numbers, each on their own line. I need to just put some delay that the user will set in another dialog box. Any ideas on how this is possible? Please help if you have any information. Thanks for your help. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

      J Offline
      J Offline
      John M Drescher
      wrote on last edited by
      #2

      Use a Sleep() before opening the file. John

      N 1 Reply Last reply
      0
      • J John M Drescher

        Use a Sleep() before opening the file. John

        N Offline
        N Offline
        NewHSKid
        wrote on last edited by
        #3

        Hi John, I need to have the delay while reading the file. I need to read a few numbers from the file, then delay for some amount of time (which is determined by the user in another dialog box) and then read some more. Can someone tell me if this is possible? if so, can someone lead me in the right direction. sample code maybe? thanks for the help. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

        J 1 Reply Last reply
        0
        • N NewHSKid

          Hi John, I need to have the delay while reading the file. I need to read a few numbers from the file, then delay for some amount of time (which is determined by the user in another dialog box) and then read some more. Can someone tell me if this is possible? if so, can someone lead me in the right direction. sample code maybe? thanks for the help. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

          J Offline
          J Offline
          John M Drescher
          wrote on last edited by
          #4

          NewHSKid wrote: Can someone tell me if this is possible? It should be pretty easy to do. Is there a chance that the delay will be long > a few seconds? The reason why I ask is it is very easy to add a Sleep(). In the simple case during the Sleep() the window will not be updated at all. If the user trys to minimize or move the window it will appear hung. If this is a problem then we will have to go about it in another way. The other question is how are you openining the file (CFile, ifstream CreateFile() ...)? There are so many functions to use. John

          N 1 Reply Last reply
          0
          • J John M Drescher

            NewHSKid wrote: Can someone tell me if this is possible? It should be pretty easy to do. Is there a chance that the delay will be long > a few seconds? The reason why I ask is it is very easy to add a Sleep(). In the simple case during the Sleep() the window will not be updated at all. If the user trys to minimize or move the window it will appear hung. If this is a problem then we will have to go about it in another way. The other question is how are you openining the file (CFile, ifstream CreateFile() ...)? There are so many functions to use. John

            N Offline
            N Offline
            NewHSKid
            wrote on last edited by
            #5

            John, Sorry for not giving you the information you need to help me. I have been trying to do this in between doing my HW. ;P Well I have an app done in MFC, with a lot of dialog boxes. I connect to the server and have to send these numbers to the server. The numbers are all different basic math calculations. Any how I write the numbers to a file, each one having its own line. My program is supposed to send all the numbers to the server, but here is the problem. The user can choose to add a delay in sending the information. So it should send one number, then delay for a short time, then send the next then delay for the same amount of time. The time is going to be no more than 1 second, and more like to be in the range of 0.1 - 1.0 seconds. Is this possible? I know it really short of a time, but that is what i was told. I open the file as:

             CStdioFile f;
             f.Open(Filename, CFile::modeNoTruncate | CFile::modeWrite);
             f.WriteString(temp);
             f.Close();
            

            MANY MANY thanks.... I really appreciate this. I need to get this app done soon. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

            J 1 Reply Last reply
            0
            • N NewHSKid

              John, Sorry for not giving you the information you need to help me. I have been trying to do this in between doing my HW. ;P Well I have an app done in MFC, with a lot of dialog boxes. I connect to the server and have to send these numbers to the server. The numbers are all different basic math calculations. Any how I write the numbers to a file, each one having its own line. My program is supposed to send all the numbers to the server, but here is the problem. The user can choose to add a delay in sending the information. So it should send one number, then delay for a short time, then send the next then delay for the same amount of time. The time is going to be no more than 1 second, and more like to be in the range of 0.1 - 1.0 seconds. Is this possible? I know it really short of a time, but that is what i was told. I open the file as:

               CStdioFile f;
               f.Open(Filename, CFile::modeNoTruncate | CFile::modeWrite);
               f.WriteString(temp);
               f.Close();
              

              MANY MANY thanks.... I really appreciate this. I need to get this app done soon. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

              J Offline
              J Offline
              John M Drescher
              wrote on last edited by
              #6

              I assume you know how to connect and send data to the server 1 number at at time. Convert the user delay value into milliseconds. Then before your Send() function call Sleep(userTime). Here is a link that talks about the accuracy of sleep: http://www.codeproject.com/system/sleepstudy.asp[^] I hope this answer is not too simplistic. I get the idea you want more but I am not sure what. John

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups