Can I use Async delegates to do infinite polling in vb.net? 2 1177
I don't exactly understand what you mean. By "infinite polling", do you
mean sitting in a loop and polling indefinitely (maybe sleeping once in
a while), or polling once every X seconds for ever?
If it's the former, then yes, you can. Fire the polling method using an
async delegate to run it on a second thread.
If it's the latter, no, you can't directly - you'll need to use a
System.Threadin g.Timer to trigger the poll once every X seconds.
Regards,
-Adam.
Viet wrote: Can I use Async delegates to do infinite polling in vb.net?
Actually, its the former: fire the polling method by sitting in a loop and
polling indefinitely. The code is I used is:
if objectIASyncRes ult.iscompleted = true then
'do something
but everytime I execute it, it executes once. Is there any code examples for
this?
THanks,
Viet
"Adam Goossens" <ad***********@ gmail.com> wrote in message
news:OK******** *****@TK2MSFTNG P15.phx.gbl... I don't exactly understand what you mean. By "infinite polling", do you mean sitting in a loop and polling indefinitely (maybe sleeping once in a while), or polling once every X seconds for ever?
If it's the former, then yes, you can. Fire the polling method using an async delegate to run it on a second thread.
If it's the latter, no, you can't directly - you'll need to use a System.Threadin g.Timer to trigger the poll once every X seconds.
Regards, -Adam.
Viet wrote: Can I use Async delegates to do infinite polling in vb.net? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
I'm using the BeginInvoke method of a delegate to invoke
a thread asynchronously and then use the EndInvoke to
retrieve the value. This works wonderfully until a
Serviced Component is added to the mix. When the
Serviced Component is invoked with BeginInvoke, the code
hangs for the duration of the call rather than running
async. Any ideas? Sample code below:
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As...
|
by: Amy L. |
last post by:
I am working on a project where I will have a ton of async DNS calls in a
console application. I would like to process the results of the Aync calls
on the same thread that made the async call. Now I was looking at the Async
WaitHandle options. They are "WaitOne", "WaitAny", and "WaitAll".
I would like to process all of the results that are returned. However, due
to network performance and other factors not all of the results are...
|
by: Shawn Meyer |
last post by:
Hello -
I am trying to write a class that has an async BeginX and EndX, plus the
regular X syncronous method. Delegates seemed like the way to go,
however, I still am having problems getting exactly what I want. Here are
my goals
1. I would like the IAsyncResult that is returned by the Begin function to
be able to be waited on or polled to check for completion.
2. The Begin function would take a callback, and the async process would
|
by: ryan |
last post by:
Hi,
I've omitted a large chunk of the code for clarity but the loop below is how
I'm calling a delegate function asynchronously. After I start the each call
I'm incrementing a counter and then making the main thread sleep until the
counter gets back to zero. The call back function for each call decrements
the counter. Is there a better way to make the thread wait until all calls
are complete besides using the counter? I've seen some things...
|
by: Bob Badger |
last post by:
Hi,
Simple question (although I guess with a complicated answer). Is HTTP
an async protocol? For instance, if I send a message to a c#
webservice via http what is the protocol actually doing?
Thanks in advance
Steffan
| |
by: Shak |
last post by:
Hi all,
I'm trying to write a thread-safe async method to send a message of the form
(type)(contents). My model is as follows:
private void SendMessage(int type, string message)
{
//lets send the messagetype via async
NetworkStream ns = client.GetStream(); //assume client globally
accessible
|
by: BartMan |
last post by:
Greetings,
I am trying to fire aysnc events in c++/clr, and I can't seem to get it to
work.
It seems to work fine in c#, but when I try c++/clr, I can't seem to get it
to compile in the c++/clr class.
I.) Event Testing in C#, which works fine:
public class CSharpEventTest
{
|
by: =?Utf-8?B?cGI=?= |
last post by:
I am having trouble doing a redirect in an async asp.net implemention.
Most of the time it works, but when it doesn't it just "hangs", the browser
never gets any return page. If I run it under the debugger, it works fine,
though every so often I get a HttpException.
System.Web.HttpException was caught
ErrorCode=-2147024809
Message="An error occurred while communicating with the remote host. The
error code is 0x80070057."...
|
by: jojoba |
last post by:
Hello to all!
I have a fairly simple webservice running in asp.net ajax under c# (vs
2008).
I built the service and it runs just dandy when i test it by itself in
visual studio.
However, to make it work, i had to break up the webmethod into the
BeginXXX, EndXXX model
as per http://msdn2.microsoft.com/en-us/library/aa480516.aspx
But now, i can no longer call this method from javascript (since to
|
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,...
|
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...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |