asynchronous

How do you measure the progress of a web service call?

I have an ASP.NET web service which does some heavy lifting, like say,some file operations, or generating Excel Sheets from a bunch of crystal reports. I don't want to be blocked by calling this web service, so i want to make the web service call asynchronous. Also, I want to call this web service from a web page, and want some mechanism...

Perl - Win32 - How to do a non-blocking read of a filehandle from another process?

I'm writing some server code that talks to a client process via STDIN. I'm trying to write a snippet of perl code that asynchronously receives responses from the client's STDOUT. The blocking version of the code might look like this: sub _read_from_client { my ($file_handle) = @_; while (my $line = <$file_handle>) { print ST...

.NET Timers: Whats is the best way to be notified in X seconds?

Suppose I have a non-recurring event that needs to be raised X seconds from now such as a timeout. Intuitively it would make sense to create a System.Timers.Timer, set its interval to X*1000, wire its tick up to the event and start it. Since this is a non-recurring event and you only want it raised once you would then have to stop the ...

Patterns for Multithreaded Network Server in C#

Are there any templates/patterns/guides I can follow for designing a multithreaded server? I can't find anything terribly useful online through my google searches. My program will start a thread to listen for connections using TcpListener. Every client connection will be handled by it's own IClientHandler thread. The server will wrap ...

Updating UI After Asynchronous WebMethod Calls

Greetings! I have a WebService that contains a WebMethod that does some work and returns a boolean value. The work that it does may or may not take some time, so I'd like to call it asynchronously. [WebService(Namespace = "http://tempuri.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.Toolb...

Boost: Fire and forget asynchronous function call?

I would like invoke a function call in a one shot manner. What's the best way to do this in Boost / C++? I would like to pass it two parameters and do not need a result. ...

Fire Async method on page load with AJAX

I am using ASP.NET 2.0 with AJAX Extensions (1.0?) and am wondering if it is possible to call a method asynchronously and have the results populate on the page after it has been loaded. I have a gridview that is populated by a fairly long-running SQL query. I would prefer to have the page come up and the results trickle back in as they ...

How can I upload files asynchronously with JQuery?

I would like to upload a file asynchronously with JQuery. This is my HTML: <span>File</span> <input type="file" id="file" name="file" size="10"/> <input id="uploadbutton" type="button" value="Upload"/> And here my javascript: $(document).ready(function() { $("#uploadbutton").click(function() { var filename = $("#file")...

Making a Nonblocking socket for WinSocks and *nix

In C/C++, how would I turn a blocking socket into a non blocking socket in both WinSocks and *nix; so that select() would work correctly. You can use the pre-processor for the platform specific code. ...

DDD and Asynchronous Repositories

We're working on a rich client (written in Flex) that is connected to a Java backend, using both RMI and JMS. I was thinking about implementing the client in a DDD fashion so that it has Repositories for the CRUD operations on the domain objects. The problem is however that all backend communication happens asynchronous and there is no ...

Ending asynchronous delegate invocation with partial type information

When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache): IAsyncResult BeginPut(string key, object value) { Action<string, object> put = this.cache.Put; return put.BeginInvoke(key, value, n...

[.NET] Use asynchronous delegates or ThreadPool.QueueUserWorkItem for massive parallelism?

I have a .NET application that processes around 300,000 records in a batch import, and it takes a few seconds per record so I would like to parallelize this. In the following code, what's the difference between ProcessWithAnsycDelegates() and ProcessWithThreadPool()? public class ResultNotification { public EventHandler event Success; ...

How to use HttpWebRequest (.NET) asynchronously?

How can I use HttpWebRequest (.NET, C#) asynchronously? ...

networking in .net/C#

Could somebody please point me in the right direction for learning how to do networking in C#/.net 3.5? Code samples and explanations are welcome. Basically I am looking for how to do asynchronous/multithreaded server/client models. I am fairly comfortable with the basics in how to accomplish this in C++ with WinSock but though all of m...

How does calling an updating UI thread from a Work thread works ?

If i have a function in a thread that is processing some data, then it calls a callback function to update the status in the UI. If the UI takes time to process the callback function then it is not so much usefull. Instead of just handling the update in the callback function, should it send some kind of message to the UI that way it doe...

Sending a message to the Windows GUI Thread

I've noticed that when you create a web service object (inheriting from SoapHttpClientProtocol) and you use the Async method, it makes the callback on the Windows GUI thread. Does anyone know how this works? How can I achieve the same thing. I figure this will save me having to check for InvokeRequired in my GUI forms if I am sure th...

Asynchronous shell exec in PHP

I've got a PHP script that needs to invoke a shell script but doesn't care at all about the output. The shell script makes a number of SOAP calls and is slow to complete, so I don't want to slow down the PHP request while it waits for a reply. In fact, the PHP request should be able to exit without terminating the shell process. I've lo...

Event-based async in C#; any generic refactoring possible?

Some APIs, like the WebClient, use the Event-based Async pattern. While this looks simple, and probably works well in a loosely coupled app (say, BackgroundWorker in a UI), it doesn't chain together very well. For instance, here's a program that's multithreaded so the async work doesn't block. (Imagine this is going in a server app and...

Invoking asynchronous call in a C# web service

I'm consuming a third-party resource (a .dll) in a web service, and my problem is, that invoking this resource (calling a method) is done asynchronous - I need to subscribe to an event, to get the answer for my request. How do I do that in a c# web service? ...

How to write Asynchronous LINQ query?

After I read a bunch of LINQ related stuff, I suddenly realized that no articles introduce how to write asynchronous LINQ query. Suppose we use LINQ to SQL, below statement is clear. However, if the SQL database responds slowly, then the thread using this block of code would be hindered. var result = from item in Products where item.P...