测试数次了,没有任何问题。成功上传,而且项目没有卡住。全局代码
Public Sub s1()
try
Dim dr As DataRow
dr = DataTables("ServeIP").DataRows(0)
Dim ftp As new FTPClient
ftp.Host = dr("IP")
ftp.Account = dr("Account")
ftp.Password = dr("Password")
ftp.Port = dr("Port")
ftp.UTF8 = True
If ftp.Connect = True
Dim fname As String = Rand.NextString(12)
FileSys.CopyFile("E:\ftp_test/test.zip", "e:\ftp_test\" & fname)
output.show(ftp.Upload("E:\ftp_test/" & fname, "/" & fname & ".ftp"))
Else
output.show("ftp连接失败")
End If
ftp.close
catch ex As exception
output.show(ex.message)
End try
End Sub