Initiate the connection using TElSimpleSSHClient
Before connecting, you need to configure the TElSimpleSSHClient object as required by your server. At the very least, you must set up the following properties:
// Set server network parameters (address and port): client.Address = "192.168.5.5"; client.Port = 22; // Set User credentials client.Username = "user"; client.Password = "password"; client.KeyStorage = keyStorage; // Handle the OnKeyValidate event client.OnKeyValidate += handleKeyValidate;
Now that you are ready to connect to the server, call Open() method. The method is synchronous, meaning that it would block until connection to the server is established. In case of server unavailability, the method will block for SocketTimeout milliseconds.
If any issue occurs during the negotiation, Open() method will throw an exception. This may be accompanied by OnError event if the problem occurs on the SSH layer. It makes sense to always handle OnError event to get better control over SSH negotiation and for simplifying the troubleshooting. Error handling is described in more details in the corresponding how-to article.
If Open() completes successfully, the connection has been established.
If you want to use custom sockets, see the correpsonding how-to article.