1

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?

4

1 回答 1

1

服务器在您的 PC 上运行,IP127.0.0.1在这里表示 localhost,因此当您将 localhost 放在您的 android 应用程序上时,它会尝试访问自己的 localhost。

在您的机器上执行 ipconfig,找出您机器的 localhost 解析为什么,并使用该 IP 地址而不是 localhost 进行 ftp 连接。

于 2013-04-21T22:18:56.320 回答