AlertDialog.Builder test =new AlertDialog.Builder(ClientList.this);
test.setMessage("hi");
//test.setMessage(list.get(i));
test.show();
try{
ftpClient.connect(userip,userport);
ftpClient.login(userid, userpwd); // 로그인 유저명과 비밀번호를 입력 합니다
ftpClient.changeWorkingDirectory("/");
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
ftpClient.setFileTransferMode(org.apache.commons.net.ftp.FTP.STREAM_TRANSFER_MODE);
ftpClient.setSoTimeout(10000); // 현재 커넥션 timeout을 millisecond 값으로 입력합니다
int reply = ftpClient.getReplyCode();
if(!FTPReply.isPositiveCompletion(reply))
{
ftpClient.disconnect();
AlertDialog.Builder as =new AlertDialog.Builder(ClientList.this);
as.setMessage("이거연결해재한다.");
as.show();
}else{
AlertDialog.Builder as =new AlertDialog.Builder(ClientList.this);
as.setMessage("접속잘했어요.");
as.show();
try
{
fos = new FileOutputStream(downloadfile);
ftpClient.retrieveFile("/" + downloadfile, fos);
}//분명 이부분에 문제가있어요 근데 왜 문제가있는지모르겠어요
catch(IOException ex)
{
AlertDialog.Builder asd =new AlertDialog.Builder(ClientList.this);
asd.setMessage("다운받는데 문제가있네");
asd.show();
}finally{
if(fos != null)
{
try{
fos.close();
}catch(IOException ex)
{
AlertDialog.Builder asdd =new AlertDialog.Builder(ClientList.this);
asdd.setMessage("fos.close에문제가있네");
asdd.show();
}
}
}
ftpClient.logout();
}