如何检查 FtpWebRequest 超时
Try
Dim request As FtpWebRequest = CType(WebRequest.Create("ftp://"), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails
request.Timeout = 4000
' If 'TimeOut' = False Then
request.Credentials = New NetworkCredential("u", "p")
Using response As FtpWebResponse = CType(request.GetResponse(), FtpWebResponse)
Using responseStream As Stream = response.GetResponseStream()
Using reader As New StreamReader(responseStream)
'do this
End Using
End Using
End Using
'End If
Catch ex As Exception
End Try