Click here to Skip to main content
15,891,664 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 Updated

Asynchronous 

4 Sep 2023 by Federico Alterio
Elegant replacement for awaiting a limited set of tasks
14 Aug 2023 by Dev Leader
In this blog post, we’ll explore the concept of async lazy initialization in C#
26 Jul 2023 by 1f604
Source code and explanation of my io_uring based implementation of b3sum
2 Apr 2023 by Bruno van Dooren
In this article, I will explain Asynchronous Procedure Calls (APCs), their uses and their pitfalls
28 Feb 2023 by Member 15937505
I think if you're looking for a proper solution to this type of issue you should try out this kind of stuff to prevent this kind of issue... 1. create a function that sets a loader in your page with a unique loader id, and returns that unique...
28 Feb 2023 by Ajay_Saini
Hi, Please clarify following problem if any solution is there - In ASP.NET i am calling 4 Web Methods in parallel using $.ajax with async=true. Now lets assume there are 4 functions that i am calling to utilize the benefit of ajax as - BindGridRecords(); BindNotifications(); BindProjectFiles();...
6 Feb 2023 by Dev Leader
Problem with async void and a solution for it
11 Jan 2023 by Reza jafery
I created an algorithm for this specific case. For clearer understanding, I illustrated it as follows: Click to see I only inserted the necessary codes.
11 Jan 2023 by Reza jafery
Hi, I used the Dispatcher property to modify the UI, and I added System.Threading.Thread.Sleep(3000) in Dispatcher.Invoke block to ensure that it would not freeze, but the UI stays frozen for 3 seconds. Let's say the Dispatcher.Invoke block takes...
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"...
16 Nov 2022 by Graeme_Grant
There is a lot wrong here. 1. The method that you want to await is not marked as async 2. The asynchronous call to PerformWriteRequestAsync in method WriteMultipleCoilsAsync is not awaited. You should have: private async void...
16 Nov 2022 by Paul Dietz
I could use some help getting the WriteMultipleCoilsAsync task to run. I'm getting the error message Cannot assign void to an implicitly-typed variable on the Task.Run statement. I need to capture the response message from...
16 Nov 2022 by Richard Deeming
Graeme (Solution 1) is correct that you should avoid async void[^] wherever possible. Unfortunately, that doesn't address the actual problem. Your two WriteMultipleCoilsAsync methods return Task, not Task. That means there is no result...
11 Sep 2022 by Mark Pelf
Tutorial article on Asynchronous Events invocation in C#
12 Jun 2022 by canvas_newbi
I have a function that reads files in a directory and pushes their name into an array. But every time I try to print the array, it's empty because the code does not wait for the function to finish, even though I used await that suppose to make...
12 Jun 2022 by Richard Deeming
Your readFiles function does not return a Promise. The printFiles function has nothing to await. If you're using Node.js v10 or later, you can use fsPromises.readdir[^] instead: import { readdir } from 'node:fs/promises'; async function...
9 Jun 2022 by Pete O'Hanlon
In the previous article, I started describing how I had built a more complex TypeScript web application that retrieves data from a separate API and displays the data in a relatively visually pleasing manner.
22 Apr 2022 by Darylmo
I want to send an httpclient request asynchronously using completablefuture and also use exponential backoff and retry logic to send the message 3 times it if it fails to do it the first time. What I have tried: I haven't been able to make my...
7 Feb 2022 by Jim_Gray
Example code showing how to use Subtle Crypto to sign your request to Azure API in pure JavaScript or jQuery
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?
10 Dec 2021 by Stukeley
Hello, I have an issue with my C# code that calls an external procedure written in x64 ASM. [DllImport("...", CallingConvention = CallingConvention.StdCall)] public static extern IntPtr ApplyFilterToImageFragmentAsm(IntPtr bitmapBytes, int...
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...
10 Dec 2021 by Member 13622627
I use openweathermap to get some data (temperature) by letting user enter the Zip Code of his country. I expect to return a response that I can extract the temperature from it. Instead I get the following response Response {type: 'cors', url:...
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...
1 Nov 2021 by Bohdan Stupak
Short tip explaining the importance of asynchronous communication
29 Sep 2021 by tugrulGtx
CLOCK caching (LRU approximation) with O(1) cache hit, up to N asynchronous O(1) cache misses
15 Sep 2021 by Tharinda Hashen
I have a function named getActiveUsers which helps me to find active users I first want to get data from Reward collection, which will return 100 data to rewards array. After waiting for all the results, I want to go through the retrieved...
15 Sep 2021 by Richard Deeming
rewards.map(async (reward) => ...) returns an array of Promise options. You can't directly await an array; you need combine the array into a single Promise using Promise.all, and await that instead: await Promise.all(rewards.map(async (reward)...
2 Jul 2021 by Lee P Richardson
Asynchronous streams, the real world problem they help us solve, and some common pitfalls
6 May 2021 by honey the codewitch
Explore the inner workings of a highly capable IoT display driver for the ESP32
16 Apr 2021 by Chris_Green
Get an event fired by Thread A to execute in the context of Thread B
19 Feb 2021 by honey the codewitch
Use TaskCompletionSource to turn an event or callback based model into a Task based one
25 Nov 2020 by Member 14797054
Good day, I would like to find out how to refresh data in a MVC program, it must be an asynchronous request and you must also utilize Jquery. TIA What I have tried: Creating a partial view @Html.Partial("_Stats",...
25 Nov 2020 by Vincent Maverick Durano
Really hard to pinpoint what could be the problem without looking into your full code, but I hope you can get something from this article: ASP.NET MVC 5: Implementing a ShoutBox Feature Using jQuery and AJAX[^]
16 Sep 2020 by Jeremy D Richardson
Have a problem that I feel like must have been solved in some elegant ways but wanting some input. I'm using vanilla Javascript to solve this but wondering if perhaps there is a more elegant React solution or some other library. Problem: Have an...
16 Sep 2020 by Chris Copeland
I'm not particularly au fait when it comes to modern JS and the classes available to it, but if you're concerned about asynchronous web requests refreshing the token at the same time, you'd have to look into something like a Mutex. For the flow...
24 Aug 2020 by cupidanish
what is the difference between example 1 and example 2: Example 1: function a () { console.log("A is running"); b(); } function b () { console.log("B is running") } a(); Example 2: const fun1 = function a (callback) { ...
24 Aug 2020 by Gomehere Blogger
The callback function is important to us, Its works as an argument passing in the function. Its something required asynchronous function called and think, you need to wait for that response and want to process that response ahead that could be...
24 Aug 2020 by F-ES Sitecore
The difference is that in the first example "a" can only then go on to call "b" as the call to "b" is hard-coded in "a". In the second example the calling code decides what function "a" calls, so it could be "b", it could be "c", it could even...
13 Aug 2020 by Sandeep Mewara
I don't see the call like My.WebServices.XYZService.getXYZAsync() being made or post handler attached. Example is in VB but hopefully will give the directions to go ahead. Try following steps: 1. Reference the XYZ Web service 2. Add an event...
13 Aug 2020 by Member 14878480
Hello, I am trying to invoke a Web Services Asynchronously from a VB.Net desktop application. My code is included. When the button is clicked I call the function KycCustomerCheck(), which grabs the required parameters from my form and invokes...
24 Jul 2020 by honey the codewitch
Using await in scenarios where you want to await custom items with or without using Task.Run()
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
20 Apr 2020 by VanuDiplomat
I've used callbacks before, but only when my client code was not responsible for keeping the program/threads running (for instance in an Android app). All I want to do now, is to make a really simple Firestore Java client that listens for...
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.
8 Dec 2019 by Abdulrahman Emad
This article proposes a solution for plugging "Rg.Plugins.Popup" asynchronous into your code.
24 Sep 2019 by Member 14589606
When I run the program it says: "System.Net.Sockets.SocketException: "Normally, each socket address (protocol, network address, or port) may only be used once" It shows an error here: socketCmdText = new UdpClient(cmdTextPort); -The socketCmdText is also has a value of null This is my code:...
18 Sep 2019 by Member 14589606
Only one reading can be taken from a sensor at a time. I used the concept of asynchronous sockets, that is, it is only reading the processor temperature of a single sensor at a time. When you add more, it shows that there is an error. Any ideas would be appreciated. After executing the jobs,...
18 Sep 2019 by Patrice T
Quote: Can only read one temperature reading from the processor of the sensor, for other sensors it does not work The usage of try/catch in your code prevent the program from telling you where the problem arise, and this is an important information. A try/catch is used to hide an error that you...
18 Sep 2019 by OriginalGriff
Quote: The object reference was not set to an object instance This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable,...
16 May 2019 by ChimpTrader
A very simple query, your solution would help tremendously. Many thanks in advance. With the help of C++, I am trying to built a Win32 DLL Data Plugin using the instructions as mentioned in the ADK of a software (client), which is going to fetch data from TCP Socket based API and then inject...
16 May 2019 by KarstenK
You should ask your client to pay the costs or pay yourself to get over it. The alternative is that you mock the interface of the plugin yourself and so can verify that your code is running fine. tip: create some scenarios with lame and or broken connection to simulate error handling like...
16 May 2019 by Gerry Schmitz
Test "what part"? You can "mock" anything. You should be able to abstract the "last part" to 2 or 3 lines until someone decides to "pay up". Connect; send; receive.
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...
10 Apr 2019 by Xequence
If you want the thread to persist across new Windows you can set the thread like so. I saw there was an answer that contained more custom code when the reality is objects already exists string[] = List of Roles {"a", "b", "c"} "name" = the primary key from the database that holds the unique...
21 Mar 2019 by Amod Kumar Chandra
I am facing following issue NETSDK1064 Package AsyncUsageAnalyzers, version 1.0.0-alpha003 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. Can anyone help...
21 Mar 2019 by Richard Deeming
It's a pre-release package, so you'll need the IncludePreRelease flag to install it: Install-Package AsyncUsageAnalyzers -Version 1.0.0-alpha003 -IncludePrerelease Pre-release versions in NuGet packages | Microsoft Docs[^] NB: That package has not been updated in four years, and the GitHub...
17 Dec 2018 by Benktesh Sharma
Tips for tracking progress on multiple async tasks in Android
20 Aug 2018 by Graeme_Grant
You can do it in code behind however can get messy if you have to do it for multiple controls. The answer is, where you need to use the code in more than one time, to use a behavior rather than code behind to encapsulate the code to avoid the same code in multiple places, reduces errors, and...
20 Aug 2018 by Waqar (Vicky)
In my code behind i have a method OnFocusRequested which is called using Interface from my ViewModel when async search button command execute. the problem is that it is working fine when i just debug through each step from code. this code is not work in real time. I believe this is due to async...
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(() => { ...
9 May 2018 by wizklaus
it Returns no value Severity Code Description Project File Line Suppression State Warning CS4014 Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. What I have tried: ...
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....
18 Mar 2018 by honeyashu
In my C# code I am receiving a byte[1024] from a DLL through TCP link. Code I did for this I am attaching below. The workflow is An asynchronous packet gets received at tcp port into a byte array, which then gets copied to a different array for processing. This copied array then gets...
8 Dec 2017 by Member 13363439
Hi i have 3 method i want to load data like First come First Display.means which method execute first that should display in UI part .it should not wait for all method to be Complete. Here is My Sample code. this code is waiting for all function to be complete than page is loading.please help me...
27 Nov 2017 by Miguel Diaz Kusztrich
An infinite set of biological shape fractals in the complex plain
21 Sep 2017 by Member 13390764
By Checking the result,i know , if the service calls are made asynchronously (in parallel), the total response time will be slightly more than 8000 millisecond, NOW ,MY QUESTION IS the Class for "WeatherService" How to implement ,1 think ,I also use the EAP to solve the problem,but now TAP ...
21 Sep 2017 by Richard Deeming
When you use await, the rest of the method doesn't execute until the task you're waiting for has finished. If that task takes 8 seconds, the next task won't start until at least 8 seconds later. You need to start all three tasks at once, then wait for them all to finish. public async...
25 Aug 2017 by DotNetFellow
hi I have been trying to get SqlDataReader to work using Async/Awaits but without much success. I got IEnumerable, cannot convert Task to SqlDataReader and some other errors. Here is basically my code and I must thank in advance to anybody who can really lend a hand to help out. //App_Code...
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...
27 Jul 2017 by ervat
Page1.aspx.cs string strMsgID = //task1 returns a value; BackgroundJob.Enqueue(() => doLongJob(strMsgID)); public void doLongJob(string strMsgID) { int status = //task2(strMsgID); while( status == 2) { Thread.Sleep(10000); status = //task2(strMsgID); } }...
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.
12 Apr 2017 by Member 12330615
Hi, I want to make a code which send data to another server via serial communications. But only sending is accepted but no receiving any other data or error messages from counter part. So I - sending part application - must assume whether the sending is ok or not. How and what kind of these...
12 Apr 2017 by Jochen Arndt
If you have a uni direction communication you can't detect such errors. All you can do on the sending side is checking for interface errors when writing to the device. But such will usually not happen with serial interfaces when the device has been opened successfully. But you may use hardware...
9 Apr 2017 by nmeri17
I have a small library that should run a couple of async operations and return an object containing the result of those operations but the interpreter either says the function is not a constructor or when it accepts the constructor, the operation returns an empty object. I think my problem has...
9 Apr 2017 by Patrice T
When you don't understand what your code is doing or why it does what it does, the answer is debugger. Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is...
31 Mar 2017 by RickZeeland
I think you first need to read up on Tasks (which is the modern way of threads). Here is a good article about it: Task Parallel Library: 1 of n[^] As you already mentioned "Pseudo", it is probably best to not let all Tasks access the same USB port simultaneously. When working with Tasks you can...
31 Mar 2017 by Member 13097876
I am developing winforms application using C#. This app uses ThingMagic USB Plus RFID "M5e" reader in order to scan the tags that found. I have the manual of the reader which is Mercury API and it provides codelet sample. In the attached samples, there is not any Pseudo Asynchronous example, but...
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...
23 Mar 2017 by dell-gl62m
I have async await method in my form that I called when button1 is clicked. How do I stop the async await when I click button2?What I have tried:Private Async Sub Flash() While True Await Task.Delay(100) Label1.Visible = Not Label1.Visible End WhileEnd SubAbove code...
24 Jan 2017 by Jon McKee
Exploring multi-threading and related topics.
18 Jan 2017 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.So read your course notes, look at...
14 Dec 2016 by Paolo Parise
Graph intersection using map reduce and Akka
28 Nov 2016 by Neal Pandey
This article is a tutorial on creating a basic OData (Open Data Protocol) endpoint for a MongoDB database using MEAN stack.
7 Nov 2016 by Dirk_Strauss
In this article by Dirk Strauss, author of the book C# Programming Cookbook, he sheds some light on how to handle events, exceptions and tasks in asynchronous programming, making your application responsive.
30 Oct 2016 by sunil kumar meena
Suppose in a sample application there is a SUBMIT button, and in FORM tag I've alreasdy set POST method. So when I click on submit button it'll automatically execute respective controller's action. This id already there in MVC. Then why do we need AJAX or jQuery for the same purpose, i.e....
30 Oct 2016 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
If you don't want to reload the page, then Ajax is the solution. You can send data to server and do everything without a post back.
12 Jul 2016 by Anisuzzaman Sumon
Dear Experts,Just let me know is the following code executed as asynchronously ?My Code is shown belowpublic class CompanyController : Controller {public delegate void CompanyAuditRecordKeeper(CompanyModel company, string operationType); public ActionResult Create(CompanyModel...
12 Jul 2016 by OriginalGriff
The short answer is "maybe".The official documentation says: Executes the specified delegate asynchronously with the specified argumentswhich is pretty clear!But... It goes on to say:on the thread that the control's underlying handle was created on.Which means that it does get executed...
15 Jun 2016 by HiWay International
An absolute trick to consume WCF WebService at Xamarin Form PCL root
9 Apr 2016 by Mohamed Hamdy
A boring talk about What’s really going on at runtime...
17 Mar 2016 by Daniel JXHV
No more ORM, EF, A Stored Procedure direct Access framework for JavaScript.
13 Mar 2016 by Maxim Komlev
Experiment of Video Transcoding and Streaming on the fly to all major internet browsers (just to video tag) without Flash or Silverlight
29 Jan 2016 by Member 0123456789
/* asynchronous callback*/public static async Task AsyncCallback(P parameter, Action action){ await Task.Run(delegate() { action(parameter); });} /* to be used in async function as */await AsyncCallback(new string[]{"Hello,", "World!"},...
23 Jan 2016 by P. Marinov
Techniques for tackling multithreading problems in applications built on top of the ASP.NET core platform
21 Jan 2016 by Jagbir Saini
I am working on WEB API having oracle as a back-end. I have one scenario in which I need to call one Store Procedure which is taking some time to execute. I need to to send response or some value to the UI from Service(Web API) without waiting my procedure to execute completely. I have...
11 Jan 2016 by Member 0123456789
Javascript is interpreted language and can do asynchronous non-blocking callbacks like:/* --- in a script tag --- */function hello9000(msg, callback){ console.log("hello9000 started"); setTimeout(function() { callback(msg); },...