主页 > 编程资料 > Delphi >
发布时间:2015-09-22 作者:网络 阅读:107次

 procedure TForm1.Act_ConnetFTP;
var
FTPHost,FTPHostIP:String;
i:Integer;
begin
FTPHost:=Trim(Edit4.Text,',',');
i:=Pos('//',FTPHost,',','); //截取//以后的字符串
FTPHost:=Copy(FTPHost,i+2,Length(FTPHost)-i,',',');
FTPHostIP:=GetHostIP(FTPHost,',',');
if IdFTP1.Connected then IdFtp1.Disconnect;
IdFTP1.Host:=FTPHostIP;
IdFTP1.Port:=21;
IdFTP1.Username:=Edit2.Text;
IdFTP1.Password:=Edit3.Text;
IdFTP1.Connect;

if not IdFTP1.Connected then
showmessage('连接失败',',',');
end;
关键字词: