-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.Session.Connect
Function Connect(Address As String, Port As Integer, TimeOut As UInt32 = 0) As Boolean
Function Connect(Socket As TCPSocket, TimeOut As UInt32 = 0) As Boolean
Name | Type | Comment |
---|---|---|
Address | String |
The IP address or hostname to connect to. |
Port | Integer |
The port to connect to. |
TimeOut | UInt32 |
Optional. The length of time to wait for the TCP socket to connect (in milliseconds). |
Name | Type | Comment |
---|---|---|
Socket | TCPSocket |
The socket to use for establishing the session. |
TimeOut | UInt32 |
Optional. The length of time to wait for the TCP socket to connect (in milliseconds). |
Returns True
if the SSH session has been successfully established. Check Session.LastError and Session.LastErrorMsg for details if this method returns False
.
Initiates an SSH session, either with the Address
and Port
parameters to open a new socket, or with the Socket
parameter to use an existing connection. If you pass a TCPSocket
that is not already connected then the TCPSocket.Address
and TCPSocket.Port
properties must be set to the address/port of the SSH server.
The Address
may be a fully qualified domain name or an IPv4 address. IPv6 addresses can't be used until/unless IPv6 support is added to the Xojo TCPSocket
class. (See Xojo Feedback case #18253; <feedback://showreport?report_id=18253>)
If the TCP connection has not yet failed nor succeeded within the TimeOut
period then the attempt is aborted and Session.LastError is set to ERR_TIMEOUT_ELAPSED
(-509).
The default TimeOut
period is zero, which means no time out. The underlying TCPSocket
may still (eventually) time out, however, in which case Session.LastError
will be the Xojo socket error code negated (e.g. -103 is a name resolution error.)
This method does not check the host's fingerprint or send the user's credentials.
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2018-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.