Establishing a connection

Top  Previous  Next

To establish a connection create a new Jscape.Ssh.SshParameters instance providing hostname, username and password arguments. Using this constructor you will authenticate with the server using username/password authentication. In addition to username/password authentication the Sftp class also supports public key authentication. Using the newly created SshParameters instance as an argument to the constructor, construct a new Jscape.Sftp.Sftp instance and invoke the Sftp.Connect method.

 

Example

 

[C#]

 

// create login credentials

SshParameters sshParams = new SshParameters(hostname,username,password);

 

// create new Sftp instance

Sftp sftp = new Sftp(sshParams);

 

// establish connection

sftp.Connect();

 

 

[VB]

 

' create login credentials

Dim sshParams As SshParameters = New SshParameters(hostname, username, password)

 

' create new Sftp instance

Dim sftp As Sftp = New Sftp(sshParams)

 

' establish connection

sftp.Connect