asynchronous

How asynchronous methods work in C#?

I am using asynchronous methods in some of my project and I like it since it allows my application to be a lot more scalable. However, I am wondering how asynchronous methods really work in background? How .NET (or Windows?) knows that a call is completed? Depending on the number of asynchronous calls I made, I can see that new threads a...

Updating ASP.NET chart asynchronously

Is there any way to update one of these charts asynchronously besides calling Chart1.SaveImage() and sending the image URL to the client-side? ...

How can I implement a multi-threaded PID controller in Java?

I'm kinda new to Java, so haven't yet fully grasped the concept of multithreading.I would like to create a PIDController class that allows me to do this: ControllerMethods methods = new ControllerMethods() { public long getError(long setpoint) { ...

Asynchrony and .NET events?

I'm really embarrassed to ask such a trivial question but debugging some software now convinced me I don't really understand this issue: How does .NET events work seen from an altitude of 20,000 feet? I don't mean the delegate/event handler pattern and all this. What I mean is - what's the BIG picture: Code A is doing something. Some ...

How to process SqlCommand result (rows) as they come?

How to process SqlCommand result (rows) as they come? In other words, I am trying to do exactly what Sql Management Studio 2005 does when executing a query with many thousand rows. To me, it looks like as soon as Sql has found the first result, it notify the UI and display the rows as they come... I suppose that it can be done asynchron...

.Net Sockets -> throw System.InvalidOperationException

Hi, I've been having this issue for a while now and was never really able to resolve it. This issue only appears when I'm using the SendAsync/ReceiveAsync methods rather than the Begin/EndSend socket methods for asynchronous operations. If have a fairly sophisticated tcp socket library and been meaning to replace the BeginSend methods ...

How to know when an asynchronous call really begins?

I want to be able to measure the time it take to execute an asynchronous method. When I call the method synchronously, I run the following code and I get the exact amount of time it took a the method MyMethod. for (int i = 0; i < 5000; i++) { stopWatches[i].Start(); webService.MyMethod(new Request()); stopWatches[i].Stop()...

Catch unhandled SocketException during asynchronous HttpWebResponse read

All the asynchronous calls to HttpWebRequest.BeginGetResponse/EndGetResponse and HttpWebResponse.GetResponseStream().BeginRead/EndRead are made from try/catch blocks, however, these exceptions propagate and do not leave a chance handle them and stop application termination: Unhandled Exception: System.IO.IOException: Unable to read d...

Approach for REST request with long execution time?

We are building a REST service that will take about 5 minutes to execute. It will be only called a few times a day by an internal app. Is there an issue using a REST (ie: HTTP) request that takes 5 minutes to complete? Do we have to worry about timeouts? Should we be starting the request in a separate thread on the server and have ...

Easiest way to read/write a file asynchronously?

I am looking for a simple way to read/write a file asynchronously using Win API. What I had is mind is something like the asynchronous winsock API (WSAxxx) completion routines. However the file API doesn't seem to have those. Are they hidden somewhere? Waiting on the overlapped events in a seperate thread adds thread management overhead...

Could you give me an example of a WebClient downloading a website source code and filtering something asynchronously as to not freeze the GUI?

I've read some of the articles on MSDN but they're not quite what I need right now. Could you show me a simple application that downloads a website asyncchronously (WebClient.DownloadDataAsync) and then filters the TITLE tag of the site? I can't do this for the life of me, and I'm just trying to see a clear cut model. ...

Boost Asio async_read doesn't stop reading?

So, I've been playing around with the Boost asio functions and sockets (specifically the async read/write). Now, I thought that boost::asio::async_read only called the handler when a new buffer came in from the network connection... however it doesn't stop reading the same buffer and thus keeps calling the handler. I've been able to m...

Recommended to use Lingo with Spring?

I'm going through some examples for how to configure asynchronous JMS messaging with Spring, and the book I'm going through, Spring In Action, 2nd Edition (I know there's a 3rd edition out there), mentions using Lingo (http://lingo.codehaus.org/ for messaged-based RPC asynchronous messaging. The latest version of Lingo is a couple yea...

Dynamically creating asynchronous message queues in Java

I need to create asynchronous message queues dynamically in Java. My use case is sending email via multiple SMTP servers: I need to enforce that emails to the same SMTP server are processes sequentially, but emails to different SMTP servers may be processed concurrently. I've used JMS in the past, but as far as I can see it only allows f...

EndInvoke() - optional or not?

Hi all, An asynchronous question: I've been reading over the internet LOTS of articles for and against Delegate.EndInvoke() being optional. Most of those articles are 4-5 years old. Lots of dead links. Can anyone explain, in .NET 2.0 - is EndInvoke() indeed preventing an otherwise-inevitable memory leak, and if yes can you please spec...

Order of event handler execution

If I set up multiple event handlers, like so: _webservice.RetrieveDataCompleted += ProcessData1; _webservice.RetrieveDataCompleted += ProcessData2; what order are the handlers run when the event RetrieveDataCompleted is fired? Are they run in the same thread and sequentially in the order that are registered? ...

Using Web Services in the Flex Mate Framework

I am currently trying to use the "Invocation tags" of Mate to call my web services and delegate the WS-responses to my fault/result handlers. I want to use the generated proxies, provided by the Flex Builder, and not the plain <WebService> or <WebServiceInvoker> tags. I actually failed using several techniques: <WebServiceInvoker> doe...

In ASP.NET asynchronous pages, is it possible to execute 2 sequential, asynchronous tasks?

In ASP.NET, you can run asynchronous tasks as follows: PageAsyncTask task1 = new PageAsyncTask(BeginAsyncOperation1, EndAsyncOperation1, TimeoutAsyncOperation1, state); RegisterAsyncTask(task1); PageAsyncTask task2 = new PageAsyncTask(BeginAsyncOperation2, EndAsyncOperation2, TimeoutAsyncOperation2, state); RegisterAsyncTask(task2); ...

Some Async Socket Code - Help with Garbage Collection?

Hi all, I think this question is really about my understanding of Garbage collection and variable references. But I will go ahead and throw out some code for you to look at. // Please note do not use this code for async sockets, just to highlight my question // SocketTransport // This is a simple wrapper class that is used as the 'st...

Sockets Asyn Connection

I am new to Async Socket Connection. Can you please explain. How does this technology work. There's an existing application (server) which requires socket connections to transmit data back and forward. I already create my application (.NET) but the Server application doesn't seem to understand the XML data that I am sending. My documenta...