主题:FTP-客户端编程 (急)
如何用JAVA编写FTP客户端的STOR命令,也就是上传一个文件到FTP服务器。
代码如下; (不知哪里出错)
else if(clavier.startsWith("STOR"))
{
BufferedReader fichier=new BufferedReader(new FileReader(new File("c:\\email.txt")));
writeCommand("PASV"); //INPUT KEYBOARD
getPortNumber(br); //GET NUMBER OF PORT
writeCommand("STOR c:\\2007\\email.txt");
reponseServer();
sockData=new Socket(ip,portdata);
BufferedWriter brdataout=new BufferedWriter(new OutputStreamWriter(sockData.getOutputStream()));
reponseServer();
String bytesRead;
while((bytesRead=fichier.readLine())!=null){
brdataout.write(bytesRead);
}
reponseServer();
System.out.println("abc");
reponseServerdata(brdata);
reponseServer();
}
非常感谢,
QQ: 9191899829
EMAIL: beyondbrjava@gmail.com
代码如下; (不知哪里出错)
else if(clavier.startsWith("STOR"))
{
BufferedReader fichier=new BufferedReader(new FileReader(new File("c:\\email.txt")));
writeCommand("PASV"); //INPUT KEYBOARD
getPortNumber(br); //GET NUMBER OF PORT
writeCommand("STOR c:\\2007\\email.txt");
reponseServer();
sockData=new Socket(ip,portdata);
BufferedWriter brdataout=new BufferedWriter(new OutputStreamWriter(sockData.getOutputStream()));
reponseServer();
String bytesRead;
while((bytesRead=fichier.readLine())!=null){
brdataout.write(bytesRead);
}
reponseServer();
System.out.println("abc");
reponseServerdata(brdata);
reponseServer();
}
非常感谢,
QQ: 9191899829
EMAIL: beyondbrjava@gmail.com