Sorry, I am very new to all this multithreading stuff...
I'm working on a client/server app and I'm going to use System.Net.Sockets.NetworkStream
's Async IO methods.
I'm aware that after calling BeginRead
, the system will start calling my callback every time it receives data. The callback could take a significant amount of time to complete but it needs to complete before any other threads run this same callback.
If I simply mark my callback method as synchronized, should that be enough to ensure that each callback thread will run to completion in the order that the system received their data?
If not, what synchronization tool would be best? (e.g. Monitor
s, WaitHandle
s, Semaphore
s?, etc...)
Edit: this is in VB 2008 on Win Server 2008