问题描述
为重复问题而道歉。
我已经尝试过给出的解决方案,在我的情况下不起作用。
对于断开连接我已经处理了套接字异常,0收到的用于处理断开连接的字节。
这在服务器关闭,局域网断开的情况下非常有效。
但是当互联网断开连接时,套接字不会立即断开连接。
当我在套接字上发送一些数据后断开互联网连接时,那个时间套接字
断开连接。
如果互联网断开,我如何立即检测到套接字断开。
我试过Socket.Poll()。这不行。
我的代码是用c#.net
Apologize for repeating question.
I have already tried the solution given, doesn't work in my case.
For disconnection i have already handled socket exception , 0 bytes received for handling disconnection.
This works perfectly in case of server shutdown , lan disconnection.
But when internet disconnects, socket does not disconnects immediately.
After internet disconnection when i sent some data on socket, that time socket
get disconnected.
How do i immediately detect socket disconnection in case of internet disconnection.
I have tried Socket.Poll().This doesn't works.
My code is written in c# .net
推荐答案
这篇关于检测互联网断开时的插座断开。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!