开发者

.NET Socket Cannot Detect Disconnect Event under Windows 7

开发者 https://www.devze.com 2023-04-08 18:35 出处:网络
I\'m using System.Nets.Sockets.Socket to play the client side to connect our server. Everything works fine under Windows XP. But recently, our client report that the UI cannot alarm when it disconnect

I'm using System.Nets.Sockets.Socket to play the client side to connect our server. Everything works fine under Windows XP. But recently, our client report that the UI cannot alarm when it disconnect from the server side (by un-plug the network cable) under Windows 7. I've debug this situation, and found this case only happen in Windows7, but under Windows XP, it does work.

Then my question is, why this socket disconnect event hasn't been raised up under Wind开发者_StackOverflow社区ows 7 but XP do? Is there any way to fix this problem?

Thank you.


ehh, what event?

The only way to be sure that a socket is connected is by sending or receiving.

More info: http://nitoprograms.blogspot.com/2009/05/detection-of-half-open-dropped.html

0

精彩评论

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