We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65bf1d1 commit 040bcc3Copy full SHA for 040bcc3
Sources/Shout/SSH.swift
@@ -45,13 +45,14 @@ public class SSH {
45
/// - Parameters:
46
/// - host: the host to connect to
47
/// - port: the port to connect to; default 22
48
+ /// - timeout: timeout to use (in msec); default 5000 (5 seconds)
49
/// - Throws: SSHError if the SSH session couldn't be created
- public init(host: String, port: Int32 = 22) throws {
50
+ public init(host: String, port: Int32 = 22, timeout: UInt = 5000) throws {
51
self.sock = try Socket.create()
52
self.session = try Session()
53
54
session.blocking = 1
- try sock.connect(to: host, port: port)
55
+ try sock.connect(to: host, port: port, timeout: timeout)
56
try session.handshake(over: sock)
57
}
58
0 commit comments