asynchronous

Why can't I use the WaitHandle from Socket.BeginSend to wait for the operation to complete?

Hello all. I was using the following code to send data asynchronously but I noticed that using WaitOne in the AsyncWaitHandle that I get from asyncRes doesn't wait at all. I checked MSDN and it says I should use a ManualResetEvent. ... var asyncRes = _socket.BeginSend(encodedFrame, 0, encodedFrame.Length, SocketFlags.None, sendCallback,...

What if CancelIo fails?

There are a number of reasons to call CancelIo, but in my particular case I'm calling it in order to know that the system is no longer writing into a buffer. Once I know that, I can safely free the buffer. But what if CancelIo fails? What I do now is explicitly leak the buffer and throw an exception. Are there better ways to deal with t...

Stack overflow when using the System.Net.Sockets.Socket.AcceptAsync model

With respect to C# and .NET's System.Net.Sockets.Socket.AcceptAsync method, one would be required to handle a return value of "false" in order to handle the immediately available SocketAsyncEventArgs state from the synchronously processed connection. Microsoft provides examples (found on the System.Net.Sockets.SocketAsyncEventArgs class ...

hibernate 'open session in view' and asynchronous tasks

I'm utilizing the Open Session in View pattern for my jsf/icesfaces application. As usual a servlet filter is opening and closing all the hibernate sessions at the beginning and the end of a "web server thread". My problem now is that I'm using asynchronous tasks for eg. loading big lists of objects from the database. Therefore I'm crea...

Load image asynchronously from file

I have an relatively image in local storage, I want to show it to the user without disturbing UI thread. I'm currently using [[UIImage alloc] initWithContentsOfFile:path]; to load image. Any suggestions/help please.... ...

Chaining functions in a jQuery plugin

I wrote a small plugin to handle text-to-input-to-text fields for on-the-fly editing, and it includes arguments that allow a user to run functions at different intervals of the process. I want the user to be able to click the "actuator" (the element that controls the process), and choose to have an intervening function run after the but...

Will there be any issues when JQUERY Datepicker used with AJAX Update panel..??

i have used JQuery date picker in form- form contains just one text box and when we clicks on it--> it pops up the JQUERY datepicker. In other web form in same project --> i have used script manager, Update panel and one textbox --> when click on it - am not getting JQUERY Datepicker Popped.?? What will be the issue.?? Any problem with...

rails asynchronous communication and xhr polling

I need to write a Rails application (JRuby) that does asynchronous communication with another service in the background. There needs to be one connection per browser session. (It does not really need to be a open TCP connection but I need to free resources after the session ends.) The communication with the background service is not stri...

WPF - error handling with asynchronous command using BackgroundWorker

I'm using the AsyncDelegateCommand class from this blog post but I'm having trouble knowing what to do with exceptions that occur in my action delegate. I create the following command: new AsyncDelegateCommand( readFile, // action to perform () => shouldReadFile, // can the action be executed? obj => readFileFinished(true),...

What's the right pattern for creating asyncronous services?

Here's what I'm trying to do: public class EmployeeService { public void GetEmployeesAsyc(Action<IEnumerable<Employees>> callback) { ThreadPool.QueueUserWorkItem(x => { var employees = //...fetch employees ...// callback(employees); }); } } public class ViewModel { private Emplo...

Asynchronous vs. synchronous Web Services practices?

I venture that most but not all web services today are synchronous. A fundamental design decision existing if to implement asynchronous processing. Is there value in implementing a processing queue system for asynchronous web services? It is a MOM/infrastructure decision with which I am toying. Instead of going system-to-system imple...

Java Async Programming

I was wondering if any of you guys have done any high performance async based programs in java. If you have what sort of structure did you setup... How did things work? Any special APIs for working with async calls I should know about? Thanks. ...

How to call Async Web service in Java

I thought there would be lot more info/tutorials on this one, but some how I'm not able to figure out how to call an async web service using Java. The web service in question may not necessarily be a Java web service. I only have access to web service's run time WSDL. Any pointers will be greatly helpful. Also would it be possible to dy...

Async Request-Response Algorithm with response time limit

Hi, I am writing a Message Handler for an ebXML message passing application. The message follow the Request-Response Pattern. The process is straightforward: The Sender sends a message, the Receiver receives the message and sends back a response. So far so good. On receipt of a message, the Receiver has a set Time To Respond (TTR) t...

Performing an SQL query while waiting on an asyncronous operation generates an exception

The code I'm writing copies data from one table to another. It is possible the query may run for a long time so I'm performing an asynchronous query and while waiting I'm doing a count on the destination table to provide a status update. The query that does the count is getting the following exception message... The command execution c...

Async Black-Box Programming

I am currently writing a black box trading bot and I am in the process of designing the way data is passed around. I realize I want an async sort of architecture. So I have been implementing ActionListeners and ActionPerformers but some of the listeners when they get data need to do calculation which could take a while, so I am wondering...

Asynchronous delegates - are the parameters always marshalled?

If a parameter is a reference to an object, will the asynchronous invocation be passed the reference or a copy of the object (by marshalling)? ...

BeginInvoke using a Function?

Hi all, This sub works fine: Private Sub UpdateInfo(ByVal text As String, ByVal timeStamp As DateTime) If Me.lstStatus.Dispatcher.Thread Is System.Threading.Thread.CurrentThread Then ' Do stuff with Else Me.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, New Action(Of String, DateTime)(...

In a node.js application, how can I asynchronously achieve the effect of a rails controller before_filter?

I have a node.js Express application with a basic user authentication system where the session is stored in redis. I'd like to write and re-use a current_user() function that populates a JSON representation of the logged in user (if there is one) in a current_user variable. Here is the code to retrieve the user: if( req.cookie('fingerpr...

Asynchronous socket I/O on Android

Is there a decent mechanism for doing asynchronous I/O using sockets on Android? I'm aware of the existence of nio channels, but they don't work for me because I need to be able to use MulticastSockets and BluetoothSockets, neither of which support channels. I'm aware the answer is probably that there isn't one, but as this is a fairly...