/// <summary> /// 连接FTP测试 /// </summary> /// <returns>0:成功 非0:失败</returns> public int Connect() { int result = -1; FileTransfer tranfer = new FileTransfer(IP, "/", FTPUser, FTPPassword, Port); tranfer.ASCII = FTPEncoding; tranfer.SetTransferType((FileTransfer.TransferType)(int) FTPModel); result = tranfer.Connect(); //开始链接 tranfer.DisConnect(); //关闭连接 return(result); //return Connect(IP, Port, FTPUser, FTPPassword, false); }