문제

I had created a user in FileZilla Server App.It's server Address is "127.0.0.1" and it's port is "14147".I can connect to it from FileZilla and also browse it in my browser whitout any problem.But I can not connect to it with my Android emulator.This is my code:

public FTPClient ftp = new FTPClient();
ftp.connect("127.0.0.1:14147");

But I get this in Logcat:

java.net.SocketException: Host is unresolved: 127.0.0.1:14147

Is there any thing wrong?

도움이 되었습니까?

해결책

The Server runs on your PC, the IP 127.0.0.1 means localhost here, so when you put localhost on your android app, its trying to reach its own localhost.

Do an ipconfig on your machine, and find out what your machine's localhost resolves to, and use that IP address instead of localhost for your ftp connect.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top