Quote:
Originally Posted by noobie
it shouldnt be blocked when you use Connect instead of BeginConnect.
in UI thread, you already call an async delegate, which will not block UI thread untill its callback method is done.
why do you need to use async method for Connect? It doesnt matter whether your thread (its a worker thread in this case, not UI thread, be careful) is blocked or not. and given your code, your worker thread doesnt do anything after calling BeginConnect, so there is no need to be using async method there.
|
Well, if you look at the code, you can see, regardless of what happens, BeginConnect returns almost immediately. This is important, as it allows my form to continue to do things, like display connection progress, etc. Basically, the form, on a menu click, calls BeginConnect. If I use Connect there, then the form will be unresponsive until Connect returns. That is precisely what I'm trying to avoid. Using the callbacks from async stuff lets my form continue to function, while the underlying worker threads do their thing, eventually hitting a callback delegate that informs my form connection has been established. (i've changed that code quite a bit, but still having this problem.)
mordero there has a good idea though, use my own threading to do such things. I may just go about doing that, that would simplify everything since I'd know exactly what's going on. Thanks mordero.
