Click here to Skip to main content
15,884,836 members
Everything / Asynchronous

Asynchronous

asynchronous

Great Reads

by Mark Pelf
Tutorial article on Asynchronous Events invocation in C#
by Federico Alterio
Elegant replacement for awaiting a limited set of tasks
by Miguel Diaz Kusztrich
An infinite set of biological shape fractals in the complex plain
by Dev Leader
Problem with async void and a solution for it

Latest Articles

by Federico Alterio
Elegant replacement for awaiting a limited set of tasks
by Dev Leader
In this blog post, we’ll explore the concept of async lazy initialization in C#
by 1f604
Source code and explanation of my io_uring based implementation of b3sum
by Bruno van Dooren
In this article, I will explain Asynchronous Procedure Calls (APCs), their uses and their pitfalls

All Articles

Sort by Score

Asynchronous 

11 Sep 2022 by Mark Pelf
Tutorial article on Asynchronous Events invocation in C#
4 Sep 2023 by Federico Alterio
Elegant replacement for awaiting a limited set of tasks
27 Nov 2017 by Miguel Diaz Kusztrich
An infinite set of biological shape fractals in the complex plain
6 Feb 2023 by Dev Leader
Problem with async void and a solution for it
30 Nov 2015 by Nejimon CR
Implement WCF web service access from WPF with busy indicator and premature cancellation feature without using delegates, background worker, or separate event procedure
2 Apr 2023 by Bruno van Dooren
In this article, I will explain Asynchronous Procedure Calls (APCs), their uses and their pitfalls
21 Jan 2022 by Bernhard Nebel
How does asynchronous serial communication work, what Arduino libraries are there to support it, and what can go wrong?
14 Aug 2023 by Dev Leader
In this blog post, we’ll explore the concept of async lazy initialization in C#
25 Mar 2020 by Quí Nguyễn NT
This is a demonstration of a basic example of single page Angular application and micro-service architecture on Azure.
14 Dec 2016 by Paolo Parise
Graph intersection using map reduce and Akka
8 Dec 2019 by Abdulrahman Emad
This article proposes a solution for plugging "Rg.Plugins.Popup" asynchronous into your code.
29 Sep 2021 by tugrulGtx
CLOCK caching (LRU approximation) with O(1) cache hit, up to N asynchronous O(1) cache misses
23 Jul 2020 by honey the codewitch
Explore adapting Socket's async model to a task based one and adding some awaitable socket operations to your projects
13 Mar 2013 by Keifiechief
Quick descriptionI have a simple ASP.NET MVC application with two views. One of those views has a button which uses an Ajax form submit to call a method on the controller.That method on the controller first makes an asynchronous method call on the model instance which executes a long running...
12 Dec 2013 by Sergey Alexandrovich Kryukov
Why?! Create a separate thread to work with each separate telnet server and work synchronously. Synchronize those threads using thread synchronization in those rare cases when it is needed.I think asynchronous APIs get popularity when threads were not a commonplace, or just because many...
5 Feb 2014 by Sergey Alexandrovich Kryukov
The discussion in comments looks going well beyond the format of Quick Questions & Answers. You really need to design the server and client parts thoughtfully from the very beginning; so focusing on just your questions may not be so helpful. For some very relevant ideas, please see my past...
23 Jun 2015 by Rob Philpott
Hmm. Don't know whether 1000s of async requests is a great idea, but then I don't really do web stuff.However, this line:client.SendDetailsCompleted += delegate(object sender, SendDetailsCompletedEventArgs args)is in the loop, which means that any time the event is fired, the callback...
31 May 2017 by Member 13040242
We are going to talk about the problem faced because of asynchronous nature of SQL query execution in node js and the solution for it.
6 May 2021 by honey the codewitch
Explore the inner workings of a highly capable IoT display driver for the ESP32
1 Nov 2021 by Bohdan Stupak
Short tip explaining the importance of asynchronous communication
10 Dec 2021 by Richard Deeming
Mixing async with the older-style .then continuations seems like a waste. You also need to read the content of the response before you can use it. const getWeatherData = async (baseURL, ZIP, KEY) => { const response = await...
3 Jan 2023 by Pete O'Hanlon
You shouldn't be running your SQL commands in the dispatcher. What Dispatcher.Invoke does is marshall the operation back onto the thread that the Dispatcher is running on, so what you are doing here is actually forcing the "long running"...
12 Sep 2011 by faroukg
Hi there,I have a WCF webservice that executes a function that could take around 10 seconds to complete.The client can call the WCF web service asynchronously by either executing the WCF calls via a thread pool, or using the generated asynchronous methods. However I would like to...
21 Oct 2011 by Ezra Neil
Reading at your question, the first thing that come to my mind is multi-threading. Backgroundworker is threading too but you cannot effectively have more than one threads at a time.Create your own threads and by doing this you can dynamically add more threads as needed. Creating own threads...
8 Feb 2012 by Pablo Aliskevicius
I had something similar a few years ago, my program was reading from a file and inserting into a SQL database. I vaguely emember reading that asynchronous ADO required support from the underlying provider, and MS SQL Server did not provide that support. I used separate threads: one thread...
1 Apr 2012 by Rin San
Hello,I'm trying to build a Server\Client program which allows me to transfer multiple files simultaneously between my laptop and home computer. I found in an article that an asynchronous connection allows you to do that, so here's what I've done so far:The Servernamespace...
18 May 2012 by Mehdi Gholam
Take a look at A Much Easier to Use ListView[^] which will do all this for you.
3 Jul 2012 by Trak4Net
This is in VB.NET I wrote this several years ago and it has been running successfully without any issues for several years now in a client server application. I am sure it could use a good tune up, but it hasn't ever had any issues and it is heavily used transporting both textual data as well as...
10 Oct 2012 by Erick Dee
Found out what the problem was. The remote server was denying me access (401) because I was sending the DefaultCredentials in the WebClient object. It turns out that they're not the same when using the ASP Development server (your Windows account) than those sent by IIS when the app is deployed,...
28 Dec 2012 by _Noctis_
Hi guys, I'm trying to wrap my mind around this asynchronous and background worker stuff ...As a playground, i have a WPF application that searches for prime numbers.Basics are easy. Create bgw (my short for BackGroundWorker), create DoWork, RunWorkerCompleted, ProgressChanged delegates....
28 Dec 2012 by Sergey Alexandrovich Kryukov
Perhaps, first thing you need to understand is that the methods are completely agnostic to the thread they are executed in. Any thread can call any methods, and any method can be called in any thread. To really understand it, you should understand how all this call-and-return model really words....
28 Dec 2012 by db7uk
Unfortunately yes. If you do not use something like Notify Property Weaver[^] you will need to raise the notify on each property change.If you do not go down the automated route, I would really recommend setting your property value and then raising the changed event on the property setter...
20 Jan 2013 by Sergey Alexandrovich Kryukov
You need to execute the command in a separate thread. The only problem is that the intermediate results of the command execution might need to interact with the UI.You cannot call anything related to UI from non-UI thread. Instead, you need to use the method Invoke or BeginInvoke of...
7 May 2013 by KarstenK
Do the networking stuff in a own thread. Use PostThreadMessage to communicate with your main thread.
11 Oct 2013 by ASP.NET Community
JavaScript Object Notation (JSON) is one of the core technologies used in Asynchronous JavaScript and XML (AJAX). Following links help you explore
16 Nov 2013 by Member 9846371
Hello Experts,I am validating the availability of user using jquery in user form.I am using JQuery ValidationEngine._checkUserAvailability: function (field, rules, i, options) { var result = "noError"; $.ajax({ type: "POST", ...
9 Feb 2014 by User 59241
CodeProject has any number of articles on this subject. There are client/server examples of any complexity.Start here, although the author uses MFC for the application the socket stuff is pure win32.Beginning Winsock Programming - Simple TCP client[^]Beginning Winsock Programming -...
15 Jul 2014 by Matthew Dennis
// assuming you have created a CancellationToken so you can cancel the Telnet Monitors.List telnetTasks = new List();for (var i = 0; i
2 Jun 2015 by CHill60
1. Explanation of one-way command messaging:Start your research here[^]image to explain[^]2. Link to info on Greg's paper:on Google Groups[^]developer network[^]If nothing else posting this solution may draw someone's attention to your post to offer further information
10 Apr 2019 by User 10778296
I've been searching the web for this, and couldn't really find a solution that actually worked. Situation is as follows: I've got a WPF application, where I want to present the user with a simple logon form. Trying to work MVVM, so I've got a LoginViewModel with the following code behind the...
23 Jun 2015 by Richard Deeming
This is a very interesting problem. :)My first thought was that the Thread.CurrentPrincipal depends on the current thread, and an async method would end up setting it on the wrong thread. However, it appears that this property is associated with the logical call context, which correctly...
8 Jan 2016 by Dave Kreskowiak
You mean something like this? What's better about this method is you get to handle exceptions as well as timeouts quite cleanly. private async void StartButton_Click(object sender, EventArgs e) { try { string message; ...
23 Mar 2017 by Richard Deeming
Use a CancellationTokenSource[^] and a CancellationToken[^]:Private _cts As CancellationTokenSourcePrivate Async Function Flash(ByVal token As CancellationToken) As Task While Not token.IsCancellationRequested Await Task.Delay(100, token) Label1.Visible = Not...
25 Aug 2017 by Graeme_Grant
Those links are one side of the solution, the other is how to handle async calls in ASP.NET Webforms. I used this search: asp.net async webforms - Google Search[^] and found these two very helpful links for you: * Using Asynchronous Methods in ASP.NET 4.5 | Microsoft Docs[^] * The Magic of...
18 Mar 2018 by Richard MacCutchan
You are (effectively) using a static data buffer for your input messages, so any time some data arrives it has the potential to destroy what is already there. You should allocate your buffer in the async event handler, capture the data, and pass the buffer off to the method that will process it....
9 May 2018 by User 7429338
The warning means that you declared your method to be asynchronous, while the method is actually synchronous. You could make your method asynchronous like so: public async void ProcessRequests(object sender, ElapsedEventArgs args) { await Task.Run(() => { ...
10 Dec 2021 by Richard Deeming
As I suspected, the problem is that your unmanaged code is running outside of the fixed blocks, so the CLR is free to move the memory around. The pointer you pass in will be pointing to the wrong thing. Since you can't await inside a fixed...
26 Jul 2023 by 1f604
Source code and explanation of my io_uring based implementation of b3sum
30 Aug 2011 by Herman<T>.Instance
Hello everyone,Continuing my async calls I have it working in windows forms with Invoking the DataGridView.When using async dataload and databind in ASP.NET I cannot invoke the GridView component directly.When the next code is run:public partial class WebForm1 :...
1 Sep 2011 by Herman<T>.Instance
Fixed it myself!The problem was. While using the asynchronous model the page rendering was finished before the asynchronous call was finished. So when the result was there the page would have been submitted to the client!You must use the polling model to fix this problem:so my codebehind...
12 Sep 2011 by Sergey Alexandrovich Kryukov
My opinion is: all asynchronous calls dominated well threading was not introduced or well established. I don't see situation when those could beat threads. Threads are easier to implement as in a single thread all logic is sequential, they are well equipped with thread synchronization primitives...
17 Sep 2011 by faroukg
Hi there,I am calling a WCF service from a form. Service is hosted in IIS. The service with the following attributes: InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.MultipleI have set the throttling behaviour to max out at 2000 for all concurrent calls, instances and...
17 Sep 2011 by Herman<T>.Instance
Where you place null in your code (the state) you better set Proxy as value.In the EndMethod you first do:Proxy myProxy = (Proxy)ar.AsyncState; // assuming ar is declared as IASyncRestult name in methodin that case you do threadsafe asynchronous calls.
19 Oct 2011 by DANAOS_master
Hi folks,we have a dashboard application that presents data according to dynamically executed SQL read from a database.Up to now application connects to the database, loops against the grids (that present data), reads their SQL source, executes the SQL, presents the results in...
25 Oct 2011 by ShacharK
I have multiple clients, and I'm trying to send to each and every one of them some messages, using async callbacks (when a message is sent, next message is dequeued). I wanted to ask if when using Async callbacks, are they using the thread pool? or exceeding it? or anything like that.Can...
25 Oct 2011 by Rob Philpott
If you mean by async callbacks the asynchronous programming model (BeginInvoke, EndInvoke etc.) then the threadpool is generally used.http://msdn.microsoft.com/en-us/library/ms228963.aspx[^]
30 Nov 2011 by kkrakesh
I have one web page MyWebPage.aspx which while loading has to show data from two webservices along with it's own algorithm.1) WebServiceI.SomeMethod() -> Takes 10 seconds aprx. to respond.2) WebServiceII.SomeMethod() -> Takes 10 seconds aprx. to respond.3) My Algorithm -> Takes 5 second...
1 Dec 2011 by kkrakesh
Well,The answer to this problem is "System.Web.UI.PageAsyncTask" class.It allows Asynchronous calls to tasks and waits for completion on the same thread.Also multiple tasks can be created and made to run parallel.Please go through the documentation for further information...Will work in Asp.Net...
30 Jan 2012 by Herman<T>.Instance
static public void BeginAsyncReadshould bestatic public IAsyncResult BeginAsyncRead
8 Feb 2012 by aka_Rich
Hi Guys, I have some C++ code that is working in Real-Time with a decoder. Its job is to Insert into SQL 2008 R2 and its currently using ADO 2.8 to do it. However i dont want it to block while doing the Insert, because it holds up other packets arriving from the decoder. So i am trying...
20 Mar 2012 by Jaxon7
Restoring UI Responsiveness FromContinuations (Asynch file IO)
30 Mar 2012 by purplewill
I've read many articles say that IOCP is used in BeginXX/EndXX pair calls.However, when i test them, my result shown that IOCP didn't work in BeginExecuteReader call, while it worked just fine in BeginGetResponse call.I'm very confused with this outcome.Can anyone tell me the reason?Is...
31 Mar 2012 by Sergey Alexandrovich Kryukov
Your mistake on the server side is using the same thread for accepting a new connection and working with a network stream. Such schema cannot work, because your server's thread busy with working with a network stream is unable to accept new connection. Effectively, you defeat the purpose of...
8 Apr 2012 by PrabhuMuthusamy
Hi friends,I created a Web UserControl.Inside the web userControl i placed a Repeater.Inside the repeater control contains Label, Checkbox and UpdatePanel.Inside the UpdatePanel i placed the Gridview.When i checked the checkbox,i will dispaly a new column.For that when i...
10 Apr 2012 by Velkumar Kannan
Hi, I have a panelbar with four panel items. In each panel item click I have to load a usercontrol for that corresponding panelitem. The javascript in usercontrol, which is loaded on PageLoad will work fine. But the javascript in the usercontrol, which is loaded in asyn postback will...
10 Apr 2012 by Pranay Rana
Register you function in EndRequestHandler which as given below may work for you... try { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); } catch (ex) { } function...
30 May 2012 by Ratnesh_retinax
I am making a asynchronous web request in c#, and i want that the request should be alive only for a defined time(let say 30sec). I tried to use "Timeout" property but it will only work for synchronous web request.Please suggest any way to do this.Thanks in advance.
30 May 2012 by Pete O'Hanlon
Well, this[^] article has a pretty decent way to do this.
15 Jul 2012 by abhinavashubajpai
Hi all,Active Directory provides an enterprise-level tool for organizing, managing, and locating resources in a network.my question is that how can i synchronize an active dirctory with Yammer(an enterprise internal messaging tool).if anyone know about it then please respond me soon...
16 Jul 2012 by Tim Corey
Here is a document that will explain exactly how to synchronize Active Directory with Yammer:https://www.yammer.com/application_support/adsync/YammerADSync.pdf[^]The title of the document is "Active Directory Synchronization Guide"
31 Jul 2012 by z_azad
Recently I started to evaluation asynchronous communication approaches in CORBA(approaches that there are in CORBA by nature). But I couldn't find any document that illustrates this. Can anyone help me to find and even implementation them? Thanks in advance
21 Aug 2012 by Rakhesh Rajan
Hi,I have a dashboard where multiple controls access different views which has huge data.Controls are simple controls and does not have much complexity.These controls calls separate stored procedures and are binded on page load synchronously.I want these controls to load...
21 Aug 2012 by Sunil Kumar Pandab
You can go for JQuery Lazy Loading
21 Aug 2012 by Sandip.Nascar
To load asynchronously, you need to use ajax to load the page. If you are not aware of ajax, google Ajax to find many code samples. Even in codeproject there are some good articles on ajax.The concept is call a client method at the end of the page just before end form tag.The method will...
21 Aug 2012 by Prabhakaran Soundarapandian
If you are using the web services means my suggestion is, after the page has finished loading you would call the WebService’s WebMethod to get a new article, when you get the article you could use JavaScript and the DOM to show it in the page.Have a look on the below...
8 Oct 2012 by Erick Dee
Hello all,I'm having this problem with an app I tried to deploy to IIS version 6.1. My code makes an asynchronous call (via a WebClient and delegate code) to retrieve XML data from a remote server, and this is working perfectly fine when I run the app from Visual Studio 2010. However, when I...
9 Oct 2012 by Paulo Morgado
Sometimes, for demo or testing purposes, I need a synchronization context that behaves like the user interface ones but doesn’t force me to build applications with a user interface and the TPL Dataflow Library seemed like a good option to implement such synchronization context.
17 Oct 2012 by Sameer Alomari
Hello,I have 2 threads connecting communicating with the server through different ports, if the server is not ready, it's gonna pause for a while (thread.sleep) and retry.The connection attempts is in a while loop, when the first thread starts, the CPU is about 50% utilized, when the second...
16 Oct 2012 by fjdiewornncalwe
1) Using your debugger, step through the code which is pinning your CPU. Find out what calls are actually the problem. Just adding a random sleep command in is like putting a band-aid on a 2 inch gash. You may appear to have solved the problem, but it won't heal the root issue.2) Once you find...
17 Oct 2012 by Sameer Alomari
**** Update ****I found that the first thread gets connected without problems, when the second thread attempts to connect, then the CPU is 100% used.It is stuck exactly on If Not ar.AsyncWaitHandle.WaitOne(1500, False) ThenAny help is appreciated!
29 Dec 2012 by ChrisTopherus
EDIT:Sometimes you think to yourself... DOOOH :)If someone is looking for this too:http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.propertychanged.aspx[^]If you update your hole object, just do RaisePropertyChanged(null); and you'll get all...
20 Jan 2013 by IamBlessed
Hi guysI have a WPF application the uses the MVVM pattern, I also have a button in my WPF client application that is binded to the ICommand implementation, How do I make the UI responsive when the command is still running?Below is my code for my MVVM Implementationprivate void...
7 Feb 2013 by bobb024
Hello,Currently I have an FTP process that grabs as many files that exist on the specific FTP file location and then pulls them down and downloads them. Based on specs changing instead of sending multiple files they are going to send one big file. Is there any suggestions on how to pull...
7 Feb 2013 by Sergey Alexandrovich Kryukov
You cannot really improve throughput by parallel downloading of the files from the same server. (From different servers, yes, a separate thread per service could help, to certain extent. It depends where is the bottleneck. If you have low local bandwidth, even this may not help.)But of...
25 Mar 2013 by Kapil Waghe
Hello,I'm developing an C# windows application to pull data from main url and then I get the inner url's from main url data and then call the thread to get each inner url data.The same is working but in the process unless and until all inner url data is not fetched the main url data...
26 Apr 2013 by armanr
please help me friendsi have code below:when getting to "worker = ((Service1)ar.AsyncState).EndAccept(ar);"take a error:The remote server returned an error: NotFound.or exceed...time out errorpublic MainPage() { InitializeComponent(); ...
1 May 2013 by SamiDakhani
I want to call two methods asynchronously.When one of them completes execution ,the other one should abort.Is this the right approach .Can anyone please suggestusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;namespace...
2 May 2013 by Preetam U Ramdhave
Hi,the way you have found the solution is not as optimize. as you know if you used the Thread then in case of increasing calls it will hamper the performance. I have similar problem. What i have done is I used ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc),...
30 May 2013 by wujapan
Hi alli'm facing a problem with multiple timers where i have two different type of functionalities for timers with the same interval, so in order to achieve asynchronous exection i'm using System.Timers.Timer where these timers will be created on Server(system) thread but not on application...
27 Jun 2013 by Jeneesh K. Velayudhan
I have one Initialize() in my class and I am calling a delegate wrapper method from this function as follows (the call back method will call around 20 times in a sec),public Initialize(){ CX_OUTPUT_CALLBACK cb = new CX_OUTPUT_CALLBACK(OutDelegateCb); ...
22 Jul 2013 by kcjames
I have a timer which calls a function to send an asynchronous query to a controller and I need the result passed back to the timer.Here's an abbreviated version of what's going on. Public Sub Timer2_Tick(ByVal sender As Object, ByVal e As EventArgs) Dim remainingTime As...
19 Jul 2013 by Jason Gleim
Few things...First, please use the formatting tools when you post code. It makes it much more readable and helps those of us with old eyes like mine.Second, you have some fundamental architectural issues. You should probably move your download/status code to its own static class (module...
4 Aug 2013 by Member 10188113
I have node js files restservice.js and mysql.jsIn mysql.js i have two functions as elementlevelpricing and pricingdetailIn restservice.js i have api which has the code as :var workload = req.body; var workloadinfo = { workloadId: workload.workloadId, ownerId:...
11 Oct 2013 by PEIYANGXINQU
My codes is here,It run well in my localhost,but after publish it is wrong .I catch the exception,It says that have a error called " System.Threading.Tasks.Task.Wait Method (Int32, CancellationToken) in System.Threading.Tasks.~1.get_Result()",How to fix the code?My .net framework is 4.0,not...
11 Oct 2013 by Ron Beyer
According to this page[^] HttpClient.PostAsync is not supported in .NET 4 (only 4.5).In fact, the entire HttpClient doesn't exist in 4.0. So I'm not sure how you are running it on 4.Edit:Unless you are using this library[^]?
18 Oct 2013 by OriginalGriff
Doing the Threading stuff is pretty easy - a Background worker will handle that: BackgroundWorker work = new BackgroundWorker(); work.DoWork += new DoWorkEventHandler(work_DoWork); work.ProgressChanged += new...
16 Nov 2013 by Sampath Lokuge
Try below one.Note: 1.When you remove the async : false,it automatically becomes the async function. 2.You cannot test async result outside the success method.So you have to check your result inside the callback function (success)._checkUserAvailability: function (field, rules,...
17 Nov 2013 by Member 9846371
Hi Sampath,Please find below the code which you has asked:01) :: jquery.ValidationEngine.js :: (check lines 472 and 519)/** Inline Form Validation Engine 2.2, jQuery plugin** Copyright(c) 2010, Cedric Dugas* http://www.position-absolute.com** 2.0 Rewrite by Olivier...