Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top