title: How to check for FtpWebRequest timeout
body: <p>How do I check for FtpWebRequest timeout</p>
  
  <pre><code>    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
  </code></pre>