cf 2. tcpclient connect in thread with timer for timeout
Help help help. Compact Framework 2 on Windos Mobile 5 device with VS 2005. I'm beginning and i tryed to use tcpclient connect to server machine but the timeout of method is too long (44 sec). I think that if i encapsulate connect method in a thread and use a timercallback event after x second climb over the problem. After this timeout i test property connected of tcpclient and if is true run another code, then advise user for lost connection. It's possible ? if yes have some code sample to do this ?
danPosted Mar 21, 2010, 3:32 AM
Sam HobbsPosted Mar 20, 2010, 12:43 PM
You could try doing what you described in your original question; that is, use a timer. It is not clear to me how your thread would resume after the connection attempt is aborted. I think what you need to do is to do an asynchronous connection. You could then wait on either the connection or the timer. I don't know how to cancel the connection attempt; perhaps that is not necessary. Other than that, I think an asynchronous connection would work.
danPosted Mar 20, 2010, 3:27 AM
Sam HobbsPosted Mar 19, 2010, 11:22 AM