Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[tut] aSync methood

some knowledge about function
every time u running function its block ur program until it finish
that it go to next line in ur code ....

well there is other function from second type
its even exist from dos batch files [start "" /b ...]
that dont block ur program.
they work in background and ur program go to next line in code
and dont wait until function over

it can be done by using Thread class,
new thread(Go).Start(1);
or by homemade methood here some examples

'http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfileasync(v=vs.80).aspx'
this function will download your file in backgrownd
and program will move to next line in ur code
while file is downloaded <!>

'http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfile(v=vs.80).aspx'
but this function in diffrent, it will wait until u will download ur file
and later or by exeption ur program will move next code

and here more complex examples
'http://msdn.microsoft.com/en-us/library/system.windows.forms.control.begininvoke.aspx'
and there is more samples like that one
this will run somthing on main thread of ur control
but it will run in background and not block ur application

'http://msdn.microsoft.com/en-us/library/system.io.stream.beginread.aspx'
or like this one [with callback function]
this one will wait for incoming data and if u give it callBack function
when data avilible to read it will call ur callBack function [it actually pointer to the function]
and when the callback func is up, it run in diffrent thread and not block ur program
but no matter what happen your program will go to next line of the code

for some of this function u will have to use delegate
so in any case of made a delegate of some type
press f12 on the delegate function, see the defination
and make similier function with same return type & paramaeters
and use it as callback 🤗
1. It's 'TuT', not 'tet'.
2. Formatting would be nice.
3. Wasn't a great explanation of multi-threading.

Good effort, though you missed out delegates.
μεγαλομανία
LOL tet is dutch slang for tits : )
(May 19, 2011 01:17 PM)Ethereal Wrote:  1. It's 'TuT', not 'tet'.
2. Formatting would be nice.
3. Wasn't a great explanation of multi-threading.

Good effort, though you missed out delegates.

http://www.albahari.com/threading/
great site to learn multi thread
[now you break your head :P]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by ahmet1257Mar 10, 2022 09:51 AM 2 228 Mar 10, 2022 09:51 AM
Last Post: benio2
[C#] by LookdadonMar 7, 2022 01:38 PM 7 264 Mar 7, 2022 01:38 PM
Last Post: Lookdadon
[C#] by Sanchez SalesJun 18, 2020 08:11 AM 0 165 Jun 18, 2020 08:11 AM
Last Post: Sanchez Sales