我正在使用 Fluent FTP。文档说您使用
.ConnectTimeout
设置连接超时,但 C# 编译器表示这不是 FTPClient
的成员。
如何设置超时?
FTPClient.ConnectTimeout
用于旧版本。
目前有
FtpConfig.ConnectTimeout
。 FtpConfig
转到 FtpClient
构造函数。
这是我的固定代码 - 非常感谢马丁..
Private Function ftp() As FtpClient
Dim c = New FtpClient(optFTPServer, NetCredentials.UserName, NetCredentials.Password)
AddHandler c.ValidateCertificate, AddressOf validateCert
c.Config = New FtpConfig
With c.Config
.ConnectTimeout = 60000
.ReadTimeout = 60000
End With
Try
c.AutoConnect()
Catch ex As Exception
FTPcatastrophicError = ex.Message
End Try
Return c
结束功能