473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Delaying Program Execution in a Loop

I have a program that accesses a web service. One of the terms of
use of this web service is that I am not supposed to call it more
than about once per second. My program currently runs much too
fast, so I need to add some sort of timer to bring it into
compliance with their terms. Here's what my program looks like
now:

Sub ProcessData
While MoreData
PrepareWebServiceRequest
SubmitRequest
ProcessWebServiceResponse
End While
End Sub

I need to change this so that SubmitRequest waits until a second
has elapsed since it last ran. Can someone tell me how I should
do this?

Thanks.
--
Greg
----
http://www.spencerbooksellers.com
greg00 -at- spencersoft -dot- com
Aug 23 '07 #1
2 1068
In article <MP************************@news.verizon.net>, Gregory
A Greenman <se*@sig.belowdeclared...
I have a program that accesses a web service. One of the terms of
use of this web service is that I am not supposed to call it more
than about once per second. My program currently runs much too
fast, so I need to add some sort of timer to bring it into
compliance with their terms. Here's what my program looks like
now:

Sub ProcessData
While MoreData
PrepareWebServiceRequest
SubmitRequest
ProcessWebServiceResponse
End While
End Sub

I need to change this so that SubmitRequest waits until a second
has elapsed since it last ran. Can someone tell me how I should
do this?

I should add that I am using VB in VS.Net 2003.


--
Greg
----
http://www.spencerbooksellers.com
greg00 -at- spencersoft -dot- com
Aug 23 '07 #2
If you are asking how to set up a timer event handler, then there should be
plenty of examples on the web. Usually though I would call the routine
because I need to, not because I can.

Is something in your client's state changing all the time that calling the
webservice is necessary this frequently? An example of this might be a model
that needs to report home that it is a gps readout and here is where I am....

Is something in the webservice state changing that frequently that you need
to call it so often? An example of this would be that the webservice is the
track of a FedEx package and you are trying to react to where to intercept
your neighbor's goodie bag...

One of those questions should answer how often to call it.

"Gregory A Greenman" wrote:
In article <MP************************@news.verizon.net>, Gregory
A Greenman <se*@sig.belowdeclared...
I have a program that accesses a web service. One of the terms of
use of this web service is that I am not supposed to call it more
than about once per second. My program currently runs much too
fast, so I need to add some sort of timer to bring it into
compliance with their terms. Here's what my program looks like
now:

Sub ProcessData
While MoreData
PrepareWebServiceRequest
SubmitRequest
ProcessWebServiceResponse
End While
End Sub

I need to change this so that SubmitRequest waits until a second
has elapsed since it last ran. Can someone tell me how I should
do this?


I should add that I am using VB in VS.Net 2003.


--
Greg
----
http://www.spencerbooksellers.com
greg00 -at- spencersoft -dot- com
Aug 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fiona McBride | last post by:
Hi all, I have a really odd problem with some Visual Basic .NET 2003 code; I have a program that creates a number of windows which contain RichTextBox, Timers (disabled) and menus. The code...
5
by: Sargo | last post by:
Hey all, Im fairly new with C++ and i havent been able to find an answer anywhere else so far, so I'm asking here. I'm looking for a way to do a time delay. What I mean by this is where the...
7
by: Buck Rogers | last post by:
Hi all! Newbie here. Below is an example from Teach Yourself C in 21 Days. My apologies if it is a bit long. What I don't understand is how the "get_data" function can call the...
7
by: Eustace | last post by:
I have a program that contains a do-while loop, inside of which it (re)calculates a array of labels XY, each one consisting of a single digit, and print them forming an x by y rectangle. What I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.