asynchronous

Asynchronous Webrequest best practices

What is the best practice for getting a webrequest asynchronously? I want to download a page from the internet (doesn't matter what) and avoid blocking a thread as much as possible. Previously I believed that it was enough to just use the 'BeginGetResponse' and 'EndGetResponse' pair. But on closer inspection I also see that there is t...

Can We use threading in PL/SQL?

Is there any feature of asynchronous calling in PL/SQL? Suppose I am in a block of code would like to call a procedure multiple times and wouldn't bother when and what the procedure returns? BEGIN myProc(1,100); myProc(101,200); myProc(201,300); ... ... END; In the above case, I don't want my code to wait for myProc(1,100) ...

Validating and Submitting a form using Javascript + Ajax

Here's what I'm trying to do. When the 'Submit' form is clicked on my form, a javascript function will loop through all the fields of the form. For each field a function will be called which would return true/false to indicate if it was filled in correctly or not. If a false is returned, it shows an error message next to that field. If...

If ThreadPool is full, how to make Action.BeginInvoke spawn a non threadpool thread

In .net 3.5 trying to ThreadPool.QueueUserWorkItem(a=> {Work()}); when the ThreadPool has no available threads caused BeginInvoke lock up. void Work() { Action executor = () = { DoSomething(); }; IAsyncResult result = executor.BeginInvoke(null, null); using (WaitHandle hWait = result.AsyncWaitHandle) { if (hWait.Wait...

C# Begin/EndReceive - how do I read large data?

When reading data in chunks of say, 1024, how do I continue to read from a socket that receives a message bigger than 1024 bytes until there is no data left? Should I just use BeginReceive to read a packet's length prefix only, and then once that is retrieved, use Receive() (in the async thread) to read the rest of the packet? Or is ther...

C# .NET 3.5 : How to invoke an event handler and wait for it to complete

I have a class containing a worker thread which receives data from a queue in a loop. Another part of the app sinks an event from this class, which the class raises for each queue item. These events are fired asynchronously, so at busy times the other part of the app can be processing several events at once. This should be fine but we...

What is an "async IO operation" in .NET?

To cut a long story short - read this article first and then this article. In short - it's the old issue about ASP.NET and randomly switching among threads. Well, not so randomly actually. As the second article explains, this only happens "when your thread performs an async IO operation". So... what the heck is an async IO operation in t...

Silverlight: Threads / Delayed Actions / Asynchronous invocations/events

Hi, I've got the following scenario: when a user moves the mouse out of a popup, I want an animation to happen, and five seconds later, I want to remove a PopUp. This is the code I expected to do this with is: private bool leftPopup = false; public void AnimatePopupOut(object sender, MouseEventArgs e) { myAnim.Begin(); (new Thre...

Can a standard thread be reused for the Thread Pool?

I'm having some weird behavior in an application which is puzzling me. I create a thread, let's call it worker, which is responsible for handling communication requests. Clients write on a pipe while the thread consumes the requests and send messages. Now, the main loop of the thread has something like this: lock(this) { object_id =...

Asynchronous IO in Java?

What options for async io (socket-based) are there in java other then java.nio? Also does java.nio use threads in the backround (as I think .NET's async-socket-library does, maybe it's been changed) or is it "true" async io using a proper select call? ...

asp:UpdatePanel with an ASP.NET checkbox trigger

What is the EventName property when I set up a ASP.NET checkbox control as an async postback trigger for an asp.net update panel? ...

Objects returned from Silverlight Async calls lose their contained aggregates.

A call from a Silverlight 2.0 control to a WebService, returned via MyWebServiceNameEventArgs is not returning contained List<> aggregates. For Example, I've got a Person class that has a List and List. When I trace the call I see that the person has the lists are populated appropriately. However, when it arrives via the MyWebServiceN...

Good asynchronous TCP based protocol for non-realtime games?

I'm developing open source cross-platform platform for non-realtime multiplayer chat/game system. Like card games, boardgames, turn-based, etc. Servers are spawned server-side (not from users computer). Client has these game modules or downloads game module and then runs them. I've come to conclusion that best protocol is "IRC-like". S...

Providing Synchronous and Asynchronous Versions of Method in C#

I am writing an API in C# and I want to provide both synchronous and asynchronous versions of the publicly available methods. For example, if I have the following function: public int MyFunction(int x, int y) { // do something here System.Threading.Thread.Sleep(2000); return x * y; } how can I create an asynchronous version...

what is a good Pattern for using AsyncSockets in .net35 when inititiating several client connections

I'm re-building an IM gateway and hope to take advantage of the new performance features in AsyncSockets for .net35. My existing implementation simply creates packets and forwards IM requests from users to the various IM networks as required, handling request/ response streams for each connected users session(socket). i presently have...

Does an asynchronous call always create/call a new thread?

Does asynchronous call always create a new thread? Example: If Javascript is single threaded then how can it do an async postback? Is it actually blocking until it gets a callback? If so, is this really an async call? ...

Asynchronous vs Multithreading- is there a difference?

Does an asynchronous call always create a new thread? What is the between the two? EDIT: Does an asynchronous call always create or use a new thread? Wikipedia says: In programming, asynchronous events are those occurring independently of the main program flow. Asynchronous actions are actions executed in a non-blocking scheme, allo...

Processing packets in the async loop or not?

In C#, when receiving network data with the BeginReceive/EndReceive methods, is there any reason you shouldn't process the packets as soon as you receive them? Some of the tasks can be decently cpu intensive. I ask because I've seen some implementations that push the packets off into a processing queue and then handle them there. To me t...

Are the xxxxAsync Methods in .net35 sockets of any benefit when building a socket client app?

I understand the benefits of the new async sockets in .net35 as applys to building socket servers. 1) Please do these benefits apply to building client applications? 2) what would be the recommended way to use the xxxxAsync pattern when building an application that establishes multiple client connections. I would really appreciate your...

JQuery ajaxStart event not being captured in ASP.net AJAX

I have an asp.net page with a save button within an updatepanel and contenttemplate. The save works nicely, but I am trying to add a "wait" gif while the save is happening using JQuery, but the ajaxStart event is not firing. I put a simple catch shown below: $(document).ajaxStart(function(){ alert('starting'); ...