How do I check for FtpWebRequest timeout
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
You can usually set the time out value and if there is no response for the said time ,a WebException is thrown with status property as Timeout.You can catch it and handle it appropriately.