473,785 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
PrepareWebServi ceRequest
SubmitRequest
ProcessWebServi ceResponse
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 1077
In article <MP************ ************@ne ws.verizon.net> , Gregory
A Greenman <se*@sig.belowd eclared...
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
PrepareWebServi ceRequest
SubmitRequest
ProcessWebServi ceResponse
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************ ************@ne ws.verizon.net> , Gregory
A Greenman <se*@sig.belowd eclared...
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
PrepareWebServi ceRequest
SubmitRequest
ProcessWebServi ceResponse
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
277
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 runs fine and creates the windows as required, BUT if the program is left to do nothing for several hours, when it is brought back into focus it generates an exception error (Object reference not set to instance of an object - this always coincides...
5
1530
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 code outputs a line to the screen (console app) and then waits say... 5 seconds and then prints out the next line. Is this possible? Thanks in advance
7
2185
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 "continue_function", and if NO is returned to "get_data", display_report executes and the program ends? Basically I am having trouble understanding the program flow within the "if" loop in the "main" function.
7
8972
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 want to do is slow the loop down so I can see the different formations of the digits; so I tried try { Thread.sleep(1000); } catch(InterruptedException ex) {}
0
10162
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10101
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.