473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

asynchronous programming in .net

...
Does anyone know a good tutorial on asynchronous programming in .net

AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topic

I appreciate any recommendation.
Jul 21 '05 #1
6 3451
Cor
Hi Anonymous

Have a look for "remoting" on msdn, I think the first week you have enough
to do reading about async.

You can also download the vb. resource kit there are samples in it.

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing it

http://msdn.microsoft.com/vbasic/vbr...q/#installvdir
I hope this helps a little bit?

Cor

Does anyone know a good tutorial on asynchronous programming in .net?

AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topic.
I appreciate any recommendation.

Jul 21 '05 #2
If you want VB try Visual Basic .NET Power Coding, for C3
try Advanced C#, or sign up for the VB Today codeguru.com
newsletter. The VB Today columns should have a couple
examples.

The callback is a delegate/function pointer that does the
work, and the IAsyncResult is a waithandle (I think!?) for
blocking.

Paul
-----Original Message-----
Does anyone know a good tutorial on asynchronous programming in .net?
AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topic.
I appreciate any recommendation.
.

Jul 21 '05 #3
As Cor mentioned, you could use some of the samples in the Remoting
infrastructure, although multithreading and asynchronous programming don't
have to involve remoting - remoting is more or less the .net version of
DCOM.

Here's some links that may help you out with threads and asynchronous
programming.

http://msdn.microsoft.com/library/de...ingExample.asp

http://msdn.microsoft.com/msdnmag/is...t/default.aspx

http://msdn.microsoft.com/library/de...enersample.asp

I suggest you also look up topics relating to the "thread pool" and
asynchronous delegates.

Here's a quick example on how to call a method asynchronously in VB.net with
one parameter (there are more ways to do this, but this is just a simple
example)

-------------------------

' Delegate to call async
Private Delegate Sub DoStuffDelegate(Byval MyParam as String)

' Main Entry point
Private Sub Main()

' Local Variables
Dim DoStuffAsync as new DoStuffDelegate(AddressOf Me.DoStuff)
Dim objResult as IAsyncResult

' Start the async processing
objResult = DoStuffAsync.BeginInvoke(nothing, nothing)

' Do some stuff in this thread
Threading.Thread.Sleep(5000)

' Pause until the processing has finished
DoStuffAsync.EndInvoke(objResult)

End Sub
' Method that runs on a different thread
Private Sub DoStuff()

' Do stuff on a different thread
Threading.Thread.Sleep(10000)

End Sub

-------------------------

HTH,

Trev.
"..." <an*******@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Does anyone know a good tutorial on asynchronous programming in .net?

AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topic.
I appreciate any recommendation.

Jul 21 '05 #4
...
Ok, but, doesnt a normal delegate doesnt do the work in the same manner as a AsyncCallback delegate? What is the difference? Its not like the asynchronous delegate works indeed asynchronous to the parent program

----- Paul Kimmel wrote: ----
The callback is a delegate/function pointer that does the
work, and the IAsyncResult is a waithandle (I think!?) for
blocking

Pau
-----Original Message----
Does anyone know a good tutorial on asynchronous

programming in .net
AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topicI appreciate any recommendation


Jul 21 '05 #5
Sorry. Bug Fix.... (forgot the parameter!)

-------------------------

' Delegate to call async
Private Delegate Sub DoStuffDelegate(Byval MyParam as String)

' Main Entry point
Private Sub Main()

' Local Variables
Dim DoStuffAsync as new DoStuffDelegate(AddressOf Me.DoStuff)
Dim objResult as IAsyncResult

' Start the async processing
objResult = DoStuffAsync.BeginInvoke("test", nothing, nothing)

' Do some stuff in this thread
Threading.Thread.Sleep(5000)

' Pause until the processing has finished
DoStuffAsync.EndInvoke(objResult)

End Sub
' Method that runs on a different thread
Private Sub DoStuff(Byval Param as String)

' Do stuff on a different thread
Threading.Thread.Sleep(10000)

End Sub

-------------------------

HTH,

Trev.
Jul 21 '05 #6
=?Utf-8?B?Li4u?= <an*******@discussions.microsoft.com> wrote in
news:86**********************************@microsof t.com:
To be honest.. not really. My problem is, i dont see the advantage of
the AsyncCallback delegate over a normal delegate.. What is the
advantage? The only advantage that i can see, is the IAsyncResult
object, that has useful members.

Maybe i dont got it, can someone explain it to me? Asynchronous over
synchronous.


Just because a delegate is a delegate doesn't mean that it runs
asynchronously. Normal delegates have to complete their processing before
the call to invoke the delegate will return.

-mdb
Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
Hello, With asynchronous programming : Why does the callback-function (running in a worker thread) may not update the state of a control on the main-form ? The docs say that you must use a...
9
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am...
4
by: bernardpace | last post by:
Hi, I am trying to get more familiar with asynchronous programming. I was reading through the document found on the page: ...
1
by: Julian Hershel | last post by:
Reading about asynchronous programming (ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconasynchronousdesignpatterno verview.htm) I could not clarify some doubts. Hope you can help me. 1) Are...
6
by: ... | last post by:
Does anyone know a good tutorial on asynchronous programming in .net AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topic I...
1
by: org | last post by:
Hi, I'm developing a web service with should be used by an .NET CF2 client and an .NET 2.0 Windows client. I've tried to put all the connection logic into one class, which could be used in...
3
by: =?Utf-8?B?bWs=?= | last post by:
Hi everyone, I need to refactor some of our processes using the asynchronous programming model. I have defined a couple of arrays of delegates to pipline the asynchronous invocations through...
3
by: senfo | last post by:
I recently read an MSDN article by Jeff Prosise titled, Scalable Apps with Asynchronous Programming in ASP.NET (http://msdn.microsoft.com/msdnmag/issues/07/03/WickedCode/). In the article, Jeff...
2
by: =?Utf-8?B?U3JpcmFtIE1hbGxhanlvc3VsYQ==?= | last post by:
Hi, I was going through the article (http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/) regarding async programming in ASP.Net 2.0 but did not find much of an use with it. Actually...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.