Discuss this help topic in SecureBlackbox Forum
Initiate the connection
To initiate the SSH connection using simple SSH, you need to use TElSimpleSSHClient component. This component can use built-in socket mechanisms, and alternatively it lets you provide your own data transport.
TElSimpleSSHClient incapsulates SSH protocol and all supplementary objects.
First of all you need to create an instance of TElSimpleSSHClient class.
If you use built-in sockets, you need to set Address and Port properties of TElSimpleSSHClient class to the address and port of the remote server. Also you need to set UseInternalSocket property of TElSimpleSSHClient class to true.
If you want to use custom sockets, set UseInternalSocket property of TElSimpleSSHClient class to false. Then assign the event handlers for OnSend, OnReceive and OnCloseConnection events of TElSimpleSSHClient class. OnSend event is fired when the component needs to send the data to the remote server. OnReceive is fired when the component is ready to receive the remote data. OnCloseConnection is fired, if the component has closed protocol-level connection and requires that you close socket connection.
Next step is to setup connection and authentication properties. For decription of how to setup connection properties, see the corresponding how-to article. For decription of how to setup authentication properties, see the corresponding how-to article.
To handle protocol errors, which happen during connection, assign a handler to OnError event of TElSimpleSSHClient class. Socket errors are not reported using OnError event, but only via exceptions. Error handling is described in more details in the corresponding how-to article.
The final step is to call Open() method of TElSimpleSSHClient class. This method is synchronous and returns when the connection is established. If the connection could not be established, the exception happens.