Public Function getheaders(ByVal add As String) As String
Dim req As WebRequest = WebRequest.Create("http://" & add)
req.Timeout = 2000
Try
Using response As WebResponse = req.GetResponse()
Dim aa As String = response.Headers("WWW-Authenticate")
Return aa
End Using
Catch ex As WebException
Using response As WebResponse = ex.Response
If ex.Status.ToString = "Timeout" Then
Return "none"
Else
Try
Dim aa As String = response.Headers("WWW-Authenticate")
Catch exa As Exception
Return "none"
End Try
End If
End Using
End Try
End Function
//////////////////// CREATIN THREADS ///////////////////////
For i = 0 To 255
Dim t As Thread = New System.Threading.Thread(New ParameterizedThreadStart(AddressOf getheaders))
t.IsBackground = True
t.Start("192.168.1." & ai.ToString)
Next
これは正常に機能しますが、すべてのスレッドが終了すると、5分待つか接続を修復するまでインターネットを使用できなくなります
エラーはどこにありますか、またはこれを行う他の方法はありますか??