Android Studio FTP客户端无法连接

时间:2019-02-13 19:35:34

标签: c# android android-studio server ftp

我将创建一个将文件存储在ftp服务器上(用c#编写)的android应用。它们当前都连接到同一Wi-Fi。我写道:

try {
    FTPClient client = new FTPClient();
    actMsg = "created";
    client.connect("192.xxx.x.xxx",5656);
    actMsg = "connected";       
    client.disconnect();
    actMsg = "disconnected successfully";
}
catch(Exception e) {
    curMsg = e.getMessage();
}    

,它无法连接到服务器。当我将curMsg和actMsg放入Textview时,我得到了:

curMsg: null 
actMsg: created

权限:

<uses-permission android:name="android.permission.INTERNET"/>

我的c#服务器设置代码:

IPEndPoint ipEnd = new IPEndPoint(IPAddress.Any, 5656);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
sock.Bind(ipEnd);

有人可以告诉我我在做什么错吗?还是哪里出了错?

0 个答案:

没有答案