ftp 上传文件异常
luck5 2009-04-24 02:48:06 大家好:请帮我看看,谢谢
贴上部分代码:
。。。。。。
ftpClient.binary();
File file_in = new File(filename);
if (!file_in.exists()) return -1;
if (file_in.length()==0) return -2;
os = ftpClient.put(newname);
result = file_in.length();
is = new FileInputStream(file_in);
byte[] bytes = new byte[1024];
int c= 0;
while ((c = is.read(bytes)) !=1) {
os.write(bytes, 0, c);
}
。。。。。。
ftp上传文件:报2个异常,但我用ftp工具是可以上传的,证明用户是有写权限的
感觉是文件流的问题,但又找不到原因。
异常:java.net.SocketException: Software caused connection abort: socket write error
异常:sun.net.ftp.FtpProtocolException: Error reading FTP pending reply