Discuss this help topic in SecureBlackbox Forum
Handle SSH errors
SSH errors can happen for SSH connection itself, and for tunnel communication.
With TElSimpleSSHClient, all SSH errors are reported using OnError event.
With advanced SSH components (TElSSHClient and TElSSHServer), SSH connection errors are reported using OnError event of TElSSHClient and TElSSHServer classes. Tunnel communication errors are reported using OnError event of TElCustomSSHTunnel class and its descendants.
The error codes are described in documentation. Note, that the events report only the errors of SSH protocol, and not underlying socket errors.
To handle socket events, as well as unexpected internal errors which don't fall to SSH category, wrap the calls to SSH methods with appropriate exception handling statements (try/catch in C++ and C#, try/except in Delphi etc.).
If the error happens, you must call Close() method of the SSH class to cleanup the class and make it ready for the subsequent attempt.