ftp 서버에서 파일의 데이터를 읽으려고합니다. 이 코드 조각은 내 데스크톱 컴퓨터에서 실행할 때 Java에서 완벽하게 작동합니다. 나는 안드로이드에 같은 코드를 복사하고 예외가 생겼다. 예외는 다음과 같습니다android에서 ftp 파일을 읽을 수 없습니까?
때 java.io.IOException : 서버에 연결할 수 없습니다 : 550
내가 같은 코드가 자바 perfecty 작업하는 경우가 발생하는 이유를 전혀 몰라 : 파일을 검색 할 수 없습니다. 자바 코드는 다음과 같습니다
String s = "ftp://username:[email protected]:21/sg1996text.txt;type=i";
URL u;
String f="";
try {
u = new URL(s);
URLConnection uc=u.openConnection();
BufferedInputStream bis=new BufferedInputStream(uc.getInputStream()); //This is where exception i raised.
System.out.println("IS opened");
int i;
while((i=bis.read())!=-1)
f=f+(char)i;
System.out.println("File Read");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
나는 동일한 오류가 발생하는 simular 문제가 있습니다. –
비슷한 질문 : http://stackoverflow.com/questions/7053513/howto-do-a-simple-ftp-get-file-on-android –