asynchronous

Strategies for calling synchronous service calls asynchronously in C#.

With business logic encapsulated behind synchronous service calls e.g.: interface IFooService { Foo GetFooById(int id); int SaveFoo(Foo foo); } What is the best way to extend/use these service calls in an asynchronous fashion? At present I've created a simple AsyncUtils class: public static class AsyncUtils { public stat...

Async email from .Net

I'm trying to send an email async so it doesn't slow down my front end (Asp.Net MVC). SmtpClient smtp = new SmtpClient(_mailServer, 25); smtp.UseDefaultCredentials = true; MailMessage message = new MailMessage(); // ...etc smtp.SendA(message); // this works fine smtp.SendAsync(message, null); // if i change it to this, it doesn't wor...

How can I call an Objective-c static method asynchronously?

How can I call a static method asynchronously? + (void) readDataFromServerAndStoreToDatabase { //do stuff here //might take up to 10 seconds } ...

How to get content from URL asynchronously?

I'm trying here to create NSXMLParser from content of URL, it work perfectly well but is there way I can make URL content to be received asynchronously and later create NSXMLParser? NSURL *url = [[NSURL alloc] initWithString: @"http://www.Xmlfile.com"]; NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [url release]...

C sharp asynchronous invocation with wsa replyTo

Hi, I am trying to make an asynchronous call to a web service using BeginXXX and EndXXX methods from C sharp client. I am using a proxy class generated by using SvcUtil.exe. The soap message that I expect to send should contain soap header elements for ws-addressing which include tags: 'wsa:Action' 'wsa:MessageID' 'wsa:ReplyTo' 'w...

Writing Async(Or async like) Client Socket Code in Java

I am writing a socket client for interacting with a network service. Currently because I want to support async reading and writing I am threading both the output stream and the input stream of one socket, but I was wondering if there is a better way to do this. I have taken a look at Java NIO and was not very impressed, and I also looked...

asynchronous client socket closing ??

hey i want to ask a question about asynchronous socket communication on c#. everything is working well for now apart from closing clients. server doesnot close immediately the worker socket for client when a client close its conneciton. it closes a few time later. how can i resolve this problem?? ...

System with two asynchronous processes

I'm planning to write a system which should accept input from users (from browser), make some calculations and show updated data to all users, currently visiting certain website. Input can come one time in a hour, but can also come 100 times each second. It is VERY important not to loose any of user inputs, but really register and proce...

Javascript, setTimeout in while() loop / race condition

Hi all, I am thinked to try to synchronizing two scripts (own firefox extension and greasemonkey's unsafeWindow.VARIABLE); In extension: window.ISS_NEED_SEND = 0; window.SENDWHAT = 0; while ... { if (window.ISS_NEED_SEND === 1) { writeFile(window.SENDWHAT); // safe synchronous call. window.ISS_NEED_SEND = 0; } In Greasemonkey:...

C# Console App Terminating Before ASync Call Completion

I'm currently writing a C# console app that generates a number of urls that point to different images on a web site and then downloads those URLs as byte streams using WebClient.DownloadDataAsync. My issue is that once the first asynchronous call is made, the console app considers the program to be completed and terminates before the as...

Socket.SendAsync taking several seconds to complete.

I'm trying to optimize a tcp socket wrapper which is struggling with lots of inbound connections. I'm testing it within a basic chat server and a small client app to send clients to it. Both apps are on a separate W2k3 server connected by a gigabit switch. By trial and error I've refined my testing to 10 clients connecting at 100ms in...

Mocking Asynchronous Calls in Silverlight WCF Proxy using Moq

I have a typical Silverlight application with a WCF service and I am using slsvcutil.exe to generate the standard client proxy to communicate with the web service. I am trying to write unit tests and I'm attempting to use the Silverlight Unit Testing framework and Moq to mock the proxy and remove the service dependency for testing. I am...

Asynchronous method queue in Javascript

I am attempting to implement an asynchronous method queue in Javascript as seen in this blog post Here's what I have so far: function Queue() { this._methods = []; this._response = null; this._flushed = false; } (function(Q){ Q.add = function (fn) { if (this._flushed) fn(this._response); else this._methods.push(fn); ...

Async calls in WP7

Hi all, I have been experimenting with WP7 apps today and have hit a bit of a wall. I like to have seperation between the UI and the main app code but Ive hit a wall. I have succesfully implemented a webclient request and gotten a result, but because the call is async I dont know how to pass this backup to the UI level. I cannot seem t...

How can i disable all setTimeout events

hello. i am using ajax and asp.net . i have a javascript function which creates many setTimeouted other javascript functions . after asynchronous postback happened i want to disable all of this setTimeouted events. thank you. ...

Upload files asynchronously (AJAX) with HTTP/1.1 PUT method, why not ?

Uploading files via PUT method, even binary or text, via a "normal web browser" is possible. Why many people are just saying, that is not possible ? Sample code with jQuery and PHP. $(document).ready(function() { $("#uploadbutton").click(function() { var filename = $("#file").val(); $.ajax({ type: "PUT", ...

async calls inside get accessor - is it good practice?

Hi! I have a window that shows customer infomation. when the window loads, I call LoadCustomer() method from the constructor which loads the customer information from the database asynchorously, which sets the CurrentCustomer property. and then the UI is updated because it is bound to the CurrentCustomer. private void LoadCustomer(...

Asynchronous AJAX call problem

I have a jquery Ajax call function that I use to submit form to database to save. Also use that to get data from server and show to the user. When I post\save form data, I must show a result of the post to the user whether there was an error or not. Everything works fine if I run in synchronous mode. I get the data if I want or get the ...

Easiest way to post to a server on iPhone? I don't care about the response.

I've looked at some of the apple core API stuff, as well as ASIHTTPRequest. It's made me curious - is there a simple way to just send a nonblocking request to a URL? I could do it what seems to be the standard way - make the request object, make a useless delegate object that just ignores the response, and that's how I've been doing it. ...

Printing async data from Silverlight 4

I have a bit of a chicken-and-egg problem here... I want to print map data that is retrieved asynchronously from a web service. The problem is I don't know the selected paper size (which affects the size of the map I need to request from the service) until the user presses OK on the print dialog and the PrintPage event is fired. The o...