View Single Post
Old 02-18-2007, 04:42 AM   #11 (permalink)
Cheetah2003
Forum Novice
 
Cheetah2003's Avatar
 
Join Date: Jun 2006
Location: Laramie, Wyoming
Age: 37
Posts: 360
Send a message via ICQ to Cheetah2003 Send a message via AIM to Cheetah2003 Send a message via MSN to Cheetah2003 Send a message via Yahoo to Cheetah2003
Default

Quote:
Originally Posted by noobie View Post
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.
__________________
Take a walk on The Wild side.

Last edited by Cheetah2003; 02-18-2007 at 04:46 AM.
Cheetah2003 is offline   Reply With Quote