简体   繁体   中英

What is the default timeout for Session and Channel in JSch library in java

Does anyone know the default timeout for Session and Channel.

session.connect();
channel.connect();

I am going through the document but it doesn't explicitly say what is the default timeout ?

For the Channel , the default timeout seems to be 20 seconds.

See the implementation of the Channel.sendChannelOpen() .

The timeout here defines, how long will the connect() wait for a response to open channel request. I'd say that the name of the method is confusing, it should be open() . You are not connecting anywhere (the session is already open).


For the Session , the default timeout is set using the setTimeout() method. If not set, the default default is 0, what means "infinite". Though there's always some last resort timeout on an OS-level.

The timeout here defines:

  • How long will the connect() wait for the socket to open.
    Though this defines an upper limit only, to define a lower limit, see JSch session timeout limit .
  • Timeout for all future "reads" from the socket. See the Socket.SetSoTimeout
  • It also affects a connection to a proxy, if there's any.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM