Silverlight tcp socket never calls back the second time, unless I put a breakpoint on the connectasync call
I have a method that attempts to connect. I'm currently testing connection failure. If it fails, the user is offered a retry button. If I press it, m_tcpSocket.ConnectAsync(m_connectArgs); is called again, but I never get a callback.
However, if I put a breakpoint at the ConnectAsync call, the callback will occur.
Is there some cleanup I need to explicitly do that is done automatically when a breakpoint is hit in visual studio?
Tha开发者_运维问答nk you.
-Nick
The Completed
event on the SocketAsyncEventArgs
is not always called. You sould check the boolean return value of your call to ConnectAsync
.
A false
value indicates that the connection request has completed synchronously, the properties on the SocketAsyncEventArgs
will be ready for inspection and the Completed
event will not fire.
精彩评论