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 Scp class also supports public key authentication. Using the newly created SshParameters instance as an argument to the constructor, construct a new Jscape.Scp.Scp instance and invoke the Scp.Connect method.

 

Example

 

[C#]

 

// create login credentials

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

 

// create new Scp instance

Scp scp = new Scp(sshParams);

 

// establish connection

scp.Connect();

 

 

[VB]

 

' create login credentials

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

 

' create new Scp instance

Dim scp As Scp = New Scp(sshParams)

 

' establish connection

scp.Connect