开发者

Silverlight tcp socket never calls back the second time, unless I put a breakpoint on the connectasync call

开发者 https://www.devze.com 2023-03-04 22:00 出处:网络
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 aga

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消