asynchronous

C# async callback still on background thread...help! (preferably without InvokeRequired)

Hi there, I am writing a very simple asynchronous helper class to go along with my project. The purpose of the class is that it allows a method to be run on a background thread. Here is the code; internal class AsyncHelper { private readonly Stopwatch timer = new Stopwatch(); internal event DownloadCompleteHa...

Connect to multiple clients asynchronously

I'm trying to write a programme to connect to a list of a dozen or so clients asynchronously using VB.NET. I'm a newb to sockets and I'm having next to no luck. More of the latter to be precise. Using this MSDN article, I would like to connect to the clients and store them in a List or Dictionary. I don't suppose anyone could help? Tha...

Connect to muliple clients asynchronously

I'm trying to write a programme to connect to a list of a dozen or so clients asynchronously using VB.NET. I'm a newb to sockets and I'm having next to no luck. More of the latter to be precise. Using this MSDN article, I would like to connect to the clients and store them in a List or Dictionary. I don't suppose anyone could help? Tha...

How to use Asp.Net Async Controller for concurrent processing if the number of concurrent items depend on the user's settings?

I want to create an async version of my page to speed it up. However, the number of async requests I need depends on the user's personal settings. For example, I have a dashboard that can display numerous things. I want to do something like this: public void IndexAsync(string city) { AsyncManager.OutstandingOperations.Increment(3); N...

Windows Phone 7: web service problem

From a WindowsPhone7 application I need to query a web service by sending a "category" string parameter an expecting to get a string in return. I tried to follow identically the "Weather Forecast" sample from the MSDN, but I always get en empty string. If I add some Debug.WriteLine commands I can see that the callback executes AFTER the ...

How to create concurrent async requests when number of concurrent requests varies?

I have a controller that looks like the following: foreach(var setting in userSettings) { //connect to db here and run a 500ms query } The userSettings varies per user and so sometimes there are 2 settings which means 2 500ms queries need to run, while sometimes the user has 15 settings, meaning 15 500ms queries will run. Since ...

How to import the Python async module from a worker thread?

I'm using the GitPython package to access a Git repository from Python. This pulls in the async package. In async/__init__.py, the following happens: def _init_signals(): """Assure we shutdown our threads correctly when being interrupted""" import signal # ... signal.signal(signal.SIGINT, thread_interrupt_handler) _init...

Efficiency between select() and recv with MSG_PEEK. Asynchronous

I would like to know what would be most efficient when checking for incoming data (asynchronously). Let's say I have 500 connections. I have 3 scenarios (that I can think of): Using select() to check FD_SETSIZE sockets at a time, then iterating over all of them to receive the data. (Wouldn't this require two calls to recv for each sock...

Raise event when all asynchronous method calls are complete

Hi folks, i have the following issue: In asynchronous context i need to initialize fields of some custom object before i can proceed with other operations on it, so i do: class ContainingObject { private CustomObject _co; SomeMethod() { _co = new CustomObject(); _co.InitObjectAsyncCompleted += (s,e) => DoStuff()...

Quick test if web-page offer asynchronous HTTP?

I am fetching current data from another company's web feed. It is a simple fetch of an XML file over HTTP. They haven't provided me with much documentation - just a URL. Because I need to know as soon as possible when the data changes on their site, I need to poll frequently, which isn't a satisfactory solution for either side. I was a...

Async Function Thread.Sleep in Web Application

Hey All, I maintain a ASP.NET web application that causes a user's network connection to reset for several seconds when it executes a procedure. Therefore, the page request times out on the user's end as they never receive the web application's response (the connection dies before it gets the response packet). To resolve this situat...

Caching problem with asynchronous javascript loading with onload event

Hi guys, I am currently trying to load some js files asynchronously, so that they are not able to block the rest of the website. I mainly followed the descriptions found here: Asynchronous Javascript In terms of the non blocking loading of the javascript file this works great, but i got now the problem that the javascript file is cac...

Why are async callback socket methods usually static?

Why are async callback socket methods usually static? (assume I understand static class, method and data objects). Would there be a fundamental design/logic error if one were to write a class using these as instance methods? Is there anything special that one should be careful to avoid? ...

How can I make asynchronous URL connections on Android?

I am using the following class to connect to my web service. I would like to make this asynchronous. How can I do this? package org.stocktwits.helper; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpRe...

Problem returning an object from an AsyncTask

I have a class (RestClient.java) that extends AsyncTask: package org.stocktwits.helper; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; i...

What are some good JavaScript/AJAX interface patterns for websites?

I really like how sites like FogBugz and Facebook offer snappy user interfaces by loading page content asynchronously. What are some good resources and patterns for applying this to other websites? I am looking for a solution that creates a unique hash URL for each page, preserves history and basic browser functions, and degrades gracef...

android twitter tweet speed

Hi I have an open source. I wonder how to improve android(mobile) twitter's posting a tweet speed and when both posting and attempting to download tweets. ...

Elegantly passing an "click event" through multiple callbacks

When a non-logined user clicks on a given button, I want to stop the event, collect his oauth, collect his email if i do not have it, and then execute the event. I want to do everything in javascript because that would keep things much more simple. This is how I am executing it, and I have 2 questions: Is there a more elegant way o...

Mutual Exclusion for N Asynchronous Threads

I've got an asynchronous application, meaning that at any given time there can be N events. Is there a known algorithm for doing mutual exclusion for N threads, without hardcoding each thread to have an ID? ...

Designing a generic cancellable async operation interface

I've been considering a general purpose generic / cancellable interface for asynchronous request / responses. The requirements are as follows, it must: Support asynchronous calls Be cancellable Be generic Support request / response Support either returning in the current thread or processing the response in another response So here's...