com.jcraft.jsch.Session.setPort()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(233)

本文整理了Java中com.jcraft.jsch.Session.setPort()方法的一些代码示例,展示了Session.setPort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.setPort()方法的具体详情如下:
包路径:com.jcraft.jsch.Session
类名称:Session
方法名:setPort

Session.setPort介绍

[英]Sets the port on the server to connect to. This is normally called by JSch#getSession, so there is no need to call it, if you don't want to change the port. This should be called before #connect.
[中]设置服务器上要连接的端口。这通常由JSch#getSession调用,因此如果不想更改端口,则无需调用它。这应该在#连接之前调用。

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

session.setPort(port);

代码示例来源:origin: stackoverflow.com

JSch jsch=new JSch();
 Session session = jsch.getSession("akumar", "sindh");
 session.setPort(22);
 session.setPassword("password123");
 session.connect();
 ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
 channel.connect();

代码示例来源:origin: asakusafw/asakusafw

Session session = jsch.getSession(user, host);
if (port != null) {
  session.setPort(port);

代码示例来源:origin: com.jcraft.jsch/com.springsource.com.jcraft.jsch

public Session getSession(String username, String host, int port) throws JSchException {
 if(username==null){
  throw new JSchException("username must not be null.");
 }
 if(host==null){
  throw new JSchException("host must not be null.");
 }
 Session s=new Session(this); 
 s.setUserName(username);
 s.setHost(host);
 s.setPort(port);
 //pool.addElement(s);
 return s;
}

代码示例来源:origin: berlam/github-bucket

session.setPort(port);

代码示例来源:origin: fizzed/blaze

jschSession.setPort(uri.getPort());

相关文章

微信公众号

最新文章

更多