unable to understand connection establishment code

Jason Donnald

I am beginner in Java and as such I am having difficulty in understanding a piece of code.At this SO post the first two lines create a connection instance:

/* Create a connection instance */
Connection conn = new Connection(hostname);
/* Now connect */
conn.connect();

I am unable to get which library needs to be imported to support this? The post mentions use of JSch in the beginning but when I tried it then I couldn't where in JSch Connection class is declared? Any help will be useful for me.

Damienknight

JCraft JSCH can be used to perform SFTP and run remote commands with an SSH connection.

It does not use a Connection class. In JSCH you create a Session object, which contains connection information. You then connect the session object, then create Channel objects to send input/receive output.

Here is the session API documentation for JSCH.

Here are some examples from JCraft.

There have been quite a few JSCH questions asked here on Stack overflow, some of which include working code you could use to try it out.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在ActiveRecord模型上使用Establishment_connection时,AdapterNotSpecified

来自分类Dev

在ActiveRecord模型上使用Establishment_connection时,AdapterNotSpecified

来自分类Dev

Trying to understand a simple Linux code

来自分类Dev

Trying to understand why this Python code works

来自分类Dev

Do I understand this Function.prototype.call() code correctly?

来自分类Dev

Android VPN Service Builder。Establishment()返回null

来自分类Dev

Unable to get last connection info for SSH users (locked, no shell, public key) is there an alternative?

来自分类Dev

Error when using SourceTree with Git: 'Summary' failed with code 128: fatal: unable to read tree

来自分类Dev

两个错误:1.Unable to compile TypeScript 2.Process exited with error code 100

来自分类Dev

Trying to understand the Git Workflow

来自分类Dev

Attempting to understand pointer arithmetic

来自分类Dev

understand the output of bsdlabel

来自分类Dev

Student trying to understand callback functions

来自分类Dev

Mongo Connection异常处理

来自分类Dev

WildFly LDAP Connection JNDI

来自分类Dev

Connection.query执行

来自分类Dev

"Channel shutdown: connection error"

来自分类Dev

HTTP response connection reset?

来自分类Dev

XMPP service connection dies

来自分类Dev

Ucanaccess Connection not being created

来自分类Dev

乘以io.on(“ connection”)

来自分类Dev

Mongo Connection异常处理

来自分类Dev

ADODB.Connection 问题

来自分类Dev

PHP: Trying to understand subpattern regex match

来自分类Dev

How to understand the output of command 'gradle dependencies'?

来自分类Dev

I do not understand how execlp() works in Linux

来自分类Dev

Need to understand Javascript function hoisting example

来自分类Dev

c++: Not able to understand Message Handlers

来自分类Dev

Documentation to understand mm part of Linux kernel?

Related 相关文章

  1. 1

    在ActiveRecord模型上使用Establishment_connection时,AdapterNotSpecified

  2. 2

    在ActiveRecord模型上使用Establishment_connection时,AdapterNotSpecified

  3. 3

    Trying to understand a simple Linux code

  4. 4

    Trying to understand why this Python code works

  5. 5

    Do I understand this Function.prototype.call() code correctly?

  6. 6

    Android VPN Service Builder。Establishment()返回null

  7. 7

    Unable to get last connection info for SSH users (locked, no shell, public key) is there an alternative?

  8. 8

    Error when using SourceTree with Git: 'Summary' failed with code 128: fatal: unable to read tree

  9. 9

    两个错误:1.Unable to compile TypeScript 2.Process exited with error code 100

  10. 10

    Trying to understand the Git Workflow

  11. 11

    Attempting to understand pointer arithmetic

  12. 12

    understand the output of bsdlabel

  13. 13

    Student trying to understand callback functions

  14. 14

    Mongo Connection异常处理

  15. 15

    WildFly LDAP Connection JNDI

  16. 16

    Connection.query执行

  17. 17

    "Channel shutdown: connection error"

  18. 18

    HTTP response connection reset?

  19. 19

    XMPP service connection dies

  20. 20

    Ucanaccess Connection not being created

  21. 21

    乘以io.on(“ connection”)

  22. 22

    Mongo Connection异常处理

  23. 23

    ADODB.Connection 问题

  24. 24

    PHP: Trying to understand subpattern regex match

  25. 25

    How to understand the output of command 'gradle dependencies'?

  26. 26

    I do not understand how execlp() works in Linux

  27. 27

    Need to understand Javascript function hoisting example

  28. 28

    c++: Not able to understand Message Handlers

  29. 29

    Documentation to understand mm part of Linux kernel?

热门标签

归档