【发布时间】:2015-11-26 05:59:33
【问题描述】:
我有以下代码使用 Apache Mina SSHD 创建远程 ChannelSubsystem(FTP 客户端):
org.apache.sshd.client.channel.ChannelSubsystem c = session.createSubsystemChannel("sftp");
int authState = ClientSession.WAIT_AUTH;
while ((authState & ClientSession.WAIT_AUTH) != 0) {
System.out.println("authenticating...");
authFuture.addListener(new SshFutureListener<AuthFuture>()
{
@Override
public void operationComplete(AuthFuture arg0)
{
System.out.println("Authentication completed with " + ( arg0.isSuccess() ? "success" : "failure"));
}
});
authState = session.waitFor(ClientSession.WAIT_AUTH | ClientSession.CLOSED | ClientSession.AUTHED, 0);
}
if ((authState & ClientSession.CLOSED) != 0) {
System.err.println("error");
System.exit(-1);
}
OpenFuture openFuture = c.open().await();
如何通过ChannelSubsystem向远程FTP站点发送命令进入被动模式?
【问题讨论】:
-
你认为为什么需要使用被动模式?
标签: java ftp apache-mina sshd