【问题标题】:Is there any way to support IPV6 with common-vfs2 for ftp or cifs有什么方法可以通过 common-vfs2 支持 IPV6 用于 ftp 或 cifs
【发布时间】:2014-04-29 08:35:54
【问题描述】:

我想在 IPV6 网络环境中使用 FTP 或 CIFS 协议获取文件,但我发现 common-vfs2 不支持 IPV6。

有什么办法可以解决吗?

或任何替换为 common-vfs2 的 Jar

非常感谢

【问题讨论】:

  • 真的吗?能否提供您发现此问题的链接?

标签: java ftp ipv6 cifs vfs


【解决方案1】:

从票证VFS-524看来,commons-vfs2 似乎还不支持 IPv6。
您可以使用 JSch SFTP 作为替代,我已经尝试过 JSch 版本 0.1.54,它可以工作。示例代码如下(只是示例,请修改使其健壮):

JSch ssh = new JSch();
ssh.setKnownHosts("/home/the_user/known_hosts");
session = ssh.getSession("the_user_name", "the_ipv6_ip", 22);
session.setConfig("StrictHostKeyChecking", "yes");
session.setPassword("the_password");
session.connect();
channel = session.openChannel("sftp");
channel.connect();
ChannelSftp sftp = (ChannelSftp) channel;
sftp.get("the_remote_file_path", "local_file_path");

【讨论】:

    猜你喜欢
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-22
    • 1970-01-01
    • 2017-03-09
    相关资源
    最近更新 更多