异常断开后,winsock控件数组的Error事件会自动触发,你可在其中对断开的某个连接作相应的处理。 'Error:10053-由于超时或其它失败,连接中止 (拔掉网线,报此错误。)(Connection is aborted due to timeout or other failure) '错误:10054-连接由远程端重新设置(The connection is reset by remote side)。 If Number = 10053 Or Number = 10054 Then ...... Else ...... End If
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) 试试在Winsock的这个事件中添加语句判断
'Error:10053-由于超时或其它失败,连接中止 (拔掉网线,报此错误。)(Connection is aborted due to timeout or other failure)
'错误:10054-连接由远程端重新设置(The connection is reset by remote side)。
If Number = 10053 Or Number = 10054 Then
......
Else
......
End If
试试在Winsock的这个事件中添加语句判断