networkStream.BeginRead() / Threading doubt
-
Hi! I use the beginread() method to read data asynchrounously from a networkStream.In the documentation says that the callback method will run in another thread, and so it happens.The thing is that after the callback function ends (if i do another beginRead() or not) the thread doesn't terminate, it just stays there and if there is another async. read the same thread will respond.(different networkstreams with different threads). Shouldn't the thread terminate?If not how do i end it. When i use delegates and beginInvoke() for each call the respective thread terminates and another different thread will run the callback function, after a new beginInvoke...but when i do this with beginRead and EndRead it doesn't happen. Is this correct or am i doing anything wrong? Thanks in advance. Never say never
-
Hi! I use the beginread() method to read data asynchrounously from a networkStream.In the documentation says that the callback method will run in another thread, and so it happens.The thing is that after the callback function ends (if i do another beginRead() or not) the thread doesn't terminate, it just stays there and if there is another async. read the same thread will respond.(different networkstreams with different threads). Shouldn't the thread terminate?If not how do i end it. When i use delegates and beginInvoke() for each call the respective thread terminates and another different thread will run the callback function, after a new beginInvoke...but when i do this with beginRead and EndRead it doesn't happen. Is this correct or am i doing anything wrong? Thanks in advance. Never say never
Hi! Oops.After all the thread also stays there in the list but the threadpool says that there is no socket taken...shouldn't the thread leave the thread list (in the VStudio thread list) after it terminates? Never say never