asynchronous

Persisted properties - asynchronously

In classic ASP.NET I’d persist data extracted from a web service in base class property as follows: private string m_stringData; public string _stringData { get { if (m_stringData==null) { //fetch data from my web service m_stringData = ws.FetchData() ...

Getting data from WCF Async methods inside a foreach loop

In the code below, I have a List object. I want to iterate through each one and assign a value to one of the properties on each Item object. To get the value, I need to call an async method of a WCF service. When the call to my WCF service completes, how do I take that data and assign it to the current instance (i) in itemsList? Is t...

Socket reading data asynchronously with special message terminator

I have to connect via tcp to a server that terminates responses with 0x4 instead of the standard 0x0. I want to keep things simple and use a synchronous send/receive from the socket class. The send works but the receive blocks indefinitely because the server does not terminate messages with 0x0. I cannot synchronously read to the first 0...

Calling synchronous methods asynchronously on the UI thread

Hello I have written a class that checks a POP3 account and I'd like it to execute on a thread other than the UI thread. To do this, I've chosen the asynchronous route. In order to get the result from pop3delegate.BeginInvoke(null,null) I need to call EndInvoke but doing this in the UI thread blocks rendering the UI unusable. I could...

How to use Junit to test asynchronous processes

How do you test methods that fire asynchronous processes with Junit? I don't know how to make my test wait for the process to end (it is not exactly a unit test, it is more like an integration test as it involves several classes and not just one) ...

Best practices for converting WCF calls to async WCF calls

I am running into issues when trying to convert all my normal WCF calls to async WCF calls. I'm finding I have a refactor a lot of code and not sure exactly how to do it. I have used the method that I found here but running into issues where I need things to happen in order. private void btnSave_Click(object sender, RoutedEventArgs...

Asynchronous connection

In c#,I am using the following code: IPAddress localaddress=IPAddress.Parse("127.0.0.1"); to get a System.Net.IPAddress instance which am using in: IPEndPoint ip= new IPEndPoint(localaddress,5555); I am however getting an error saying: A field initializer cannot reference the nonstatic field, method, or property 'WindowsApplicatio...

Asynchronous connection

I need to use the function BeginConnect but then i havent been able to find any vivid example of its usage. So i want to have my callback function as say 'funct' how would the syntax be? The syntax is given in a lot of sites but i am getting a few errors when i use the method. Just send in a line that shows the usage of the method call....

Writing a socket-based server in Python, recommended strategies?

I was recently reading this document which lists a number of strategies that could be employed to implement a socket server. Namely, they are: Serve many clients with each thread, and use nonblocking I/O and level-triggered readiness notification Serve many clients with each thread, and use nonblocking I/O and readiness change notifica...

Calling a method and waiting for a return value

How do I call a method that returns a bool, but inside that method in order to determine the value of the bool, it calls a web service asyncronously? bool myBool = GetABoolean(5); public bool GetABoolean(int id) { bool aBool; client.CallAnAsyncMethod(id); // value is returned in a completed event handler. Need to somehow ...

How can I run an external command asynchronously from Python?

I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do. I read this post: http://stackoverflow.com/questions/89228/how-to-call-external-command-in-python I then went off and did some te...

Cancelling Aysnchronous stored procedure

Hello All, I am running a long running stored procedure that user can cancel. I am using Backgroundworker component along with BeginExecuteReader method of ado.net everything seems to work fine, but even when i cancel the stored procedure, the database is still running the proc Is there a way to cancel the actual job on the database ...

Synchronising an Asynchronous call in c#

I've run into quite an awkward predicament in a project at work. We need to create users across 4 or 5 different services, and have set it up in such a way that if one fails, they all fail. They're encapsulated within a transaction scope block. One of the services we need to add users to requires telnetting in, and fudging some data. Th...

Windsor WCF Integration Facility Async

I'm using Windsor WCF Integration Facility and am curently looking for a way to call a method asnyc. I was considering just using a background worker and doing the work on completion. Is there a more elegant way of doing this, i don't have a good feeling with selected way. I've looked at the following email: http://groups.google.com/gr...

ADO.NET Data Services: Non-Asynch Calls?

I have a question that I'm struggling with in ADO.NET Data Services: When assembling an Entity for storage I need to get a related value from a lookup file. For example a person has a status code assigned of 'Pending' which is in a table called StatusCodes. In Entity Framework, I'd need to set the value of person.StatusCode equal to a...

How can I easily chain two asynchronous requests together?

I've got some code that screen scrapes a website (for illustrative purposes only!) public System.Drawing.Image GetDilbert() { var dilbertUrl = new Uri(@"http://dilbert.com"); var request = WebRequest.CreateDefault(dilbertUrl); string html; using (var webResponse = request.GetResponse()) using (var receiveStream = webResponse...

handling asynchronous calls

How do I handle asynchronous calls to make sure they do not overlap? This is my scenario--- I have a loop and within the loop I make a call to a google API and specify a call back function. My callback function processes the results and writes the output to a table. However I have noticed that the results being written to the table ...

Thread Static variables for asynchronous operations in .NET

Is there any way to have ThreadStatic variables be transferred from one thread to another? I have a bunch of ThreadStatic variables, and now that I am converting my operation to be asynchronous, I want to be able to "transfer" them from the first thread (where they are set) to the callback thread (where they will be read). Is this poss...

Sleep Command in T-SQL?

Is there to way write a T-SQL command to just make it sleep for a period of time? I am writing a web service asynchronously and I want to be able to run some tests to see if the asynchronous pattern is really going to make it more scalable. In order to "mock" an external service that is slow, I want to be able to call a SQL server with...

Asynch page call from a bookmarklet with CodeIgniter

I'm trying to make a bookmarklet that will take the url of the current page you are on and send it to an application written in PHP with CodeIgniter. The problem I keep running into, however, is that I can do a standard AJAX call because it's cross-domain so it's disallowed and I can't figure out a way to use the JSONP via GET method, s...