这样调用。
CFtp Ftp=new CFtp();
boolean Re=Ftp.Connect("10.70.72.98",21);
Ftp.Login("guo","jianzhi");
//Ftp.SetCurDir("/Test");
//System.out.println(Ftp.GetCurDir());
Ftp.DownFile("c:\\W2Ksp3_CN.exe","/guo.exe");
String Dir[]=Ftp.ListFile("/");//to member every time to change a port,if you want good.
if(Dir!=null)
for (int x = 0; x < Dir.length; x++)
{
System.out.println(Dir[x]);
}
//Ftp.ReName("/W2Ksp3_CN.exe","/Win2KSP3.exe");
// Ftp.MkDir("/guo");
//Ftp.MkDir("/guo/jian");
//Ftp.RmDir("/guo/jian");
//Ftp.RmDir("/guo");
//Ftp.SendCommand("HELP");
//Ftp.SendCommand("SYST");
Ftp.DisConnect();
public boolean ReadStr()
{
int Len;
try {
Len=sockRead.read(ReadBuff);
}
catch (IOException ex) {
return false;
}
strRead=String.valueOf(ReadBuff,0,Len-2);//off the \r\n
RetCode=Integer.parseInt(strRead.substring(0,3));
System.out.println(strRead);
return strRead.length()>0;
}
public boolean WriteStr(String Write)
{
char[] Arr=Write.toCharArray();
try {
sockWrite.write(Arr);
sockWrite.flush();//user the flush,than you can do the next.! OK
System.out.print(Write);
}
catch (IOException ex) {
return false;
}
return true;
}