如何使用ftp服务器/客户端以编程方式将文件从pc推送到android设备

如何使用ftp服务器/客户端以编程方式将文件从pc推送到android设备,android,ftp,file-transfer,Android,Ftp,File Transfer,我不熟悉android编程和ftp。目前正在进行一个项目,创建android应用程序,将文件从PC传输到android设备,反之亦然。我能够使用ftp服务器/客户端方法将文件从android设备传输到PC。然而,我在如何将文件从PC推送到android设备上遇到了困难。是否可以使用ftp服务器/客户端将文件从ftp服务器(PC)推送到客户端?或者有其他办法吗?是否有我可以阅读的教程/示例 任何帮助都将不胜感激。非常感谢 从android设备传输到pc(android客户端): 你有没有为此使用任

我不熟悉android编程和ftp。目前正在进行一个项目,创建android应用程序,将文件从PC传输到android设备,反之亦然。我能够使用ftp服务器/客户端方法将文件从android设备传输到PC。然而,我在如何将文件从PC推送到android设备上遇到了困难。是否可以使用ftp服务器/客户端将文件从ftp服务器(PC)推送到客户端?或者有其他办法吗?是否有我可以阅读的教程/示例

任何帮助都将不胜感激。非常感谢

从android设备传输到pc(android客户端):


你有没有为此使用任何外部库?
FTPClient mFTP = new FTPClient();
try {
    // Connect to FTP Server
    mFTP.connect("192.168.0.103");
    mFTP.login("user", "password");
    mFTP.setFileType(FTP.BINARY_FILE_TYPE);
    mFTP.enterLocalPassiveMode();

    File file = new File(f);

    BufferedInputStream buffIn=null;
    buffIn=new BufferedInputStream(new FileInputStream(file));
    mFTP.enterLocalPassiveMode();
    mFTP.storeFile(filename, buffIn);
    buffIn.close();

    mFTP.logout();
    mFTP.disconnect();          
} catch (SocketException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}